倉庫管理系統(VB+Access+源代碼)_第1頁
倉庫管理系統(VB+Access+源代碼)_第2頁
倉庫管理系統(VB+Access+源代碼)_第3頁
倉庫管理系統(VB+Access+源代碼)_第4頁
倉庫管理系統(VB+Access+源代碼)_第5頁
已閱讀5頁,還剩17頁未讀 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、精心整理倉庫管理系統項目的建立 這是本人利用閑暇之余在VB6.0上制作的一個簡陋的類庫管系統,現圖文結合的方式一步一步展現制作過程。由于本人是個初學者,里面存在很多不足之處望得到高手們的指導。此文可作供初學者們學習交流。作者聯系方式:E-mail 最終運行效果打開軟件出現如下登錄界面輸入系統預設用戶名及密碼( 1 1 )單擊“登錄”或單擊“新用戶”添加新用戶進入如下主界面:建立工程1、 創(chuàng)建標準EXE2、 按“打開”3、 添加MDI窗體打開4、 編輯菜單在空白處右擊點擊“菜單編輯器”在“標題”里輸入“系統”,在“名稱”里輸入“Sys”(注意此處不能為漢字)點擊“下一個”再點擊“ ”“確定”退到

2、MDI界面點擊“系統”“退出”如下,然后編寫代碼。代碼如下: Private Sub Exit_Click() EndEnd Sub數據庫的建立VB6.0中可以創(chuàng)建Access數據庫。如下建立一個“用戶表”的數據庫,用來存放用戶信息及一些出入庫管理信息。如下圖單擊“外接程序”再單擊“可視化數據管理器”出現如圖點擊“文件”“新建”“Microsoft Access”“Version 2.0 MDB”輸入數據庫名,“保存”出現如下圖在數據窗口中右擊“新建表”,最終如下往數據表里添加數據在這里就不羅嗦了,請查閱相關書籍。登錄界面窗口的建立 最終界面如下:1、Adodc1的添加過程為:單擊“工程”“部

3、件”出現下圖所示,選擇“控件”下的“Microsoft ADO Data Control 6.0 (OLEDB)” 單擊“確定”在工具欄中會出現“”圖標,單擊它并拖動到相應位置即可。其它元件不在一一說明。2、 本窗體代碼如下:Private Sub Command1_Click() '“登錄”、“確定”按鈕 If Command1.Caption = "確定" And Command2.Caption = "取消" Then '如果為“確定”則添加新用戶 If Text1.Text = "" Then '提示用

4、戶輸入用戶名 MsgBox "請輸入用戶名!", , "登錄信息提示:" Exit Sub Else ' Dim usename As String '檢測用戶名是否已經存在 Dim strS As String usename = Trim(Text1.Text) strS = "select * from 用戶登錄信息表 where 用戶名='" & usename & "'" Adodc1.CommandType = adCmdText Adodc1.Recor

5、dSource = strS Adodc1.Refresh MsgBox "您輸入的用戶已存在!", , "登錄提示信息:" Text1.Text = "" Text2.Text = "" Text3.Text = "" Text1.SetFocus Exit Sub End If End If If Text2.Text = "" Then '提示用戶密碼不能為空 MsgBox "密碼不能為空!", , "登錄提示信息:" T

6、ext2.SetFocus Exit Sub End If If Text3.Text = "" Then MsgBox "請再次輸入密碼!", , "登錄提示信息:" Text3.SetFocus Exit Sub End If If Text2.Text <> Text3.Text Then MsgBox "兩次輸入的密碼不一致,請確認!", , "登錄提示信息:" Text2.Text = "" Text3.Text = "" Text2

7、.SetFocus Exit Sub Else MsgBox ("添加新用戶成功,現在您可以登陸系統了!") Label3.Visible = False Text3.Visible = False Command1.Caption = "登錄" Command2.Caption = "退出" End If Else '“登錄”按鈕,用戶登錄 Dim strSno As String Dim strSelect As String strSno = Trim(Text1.Text) '檢測用戶名是否存在 strSele

8、ct = "select 密碼 from 用戶登錄信息表 where 用戶名 = '" & strSno & "'" Adodc1.CommandType = adCmdText Adodc1.RecordSource = strSelect Adodc1.Refresh MsgBox "用戶名不存在,請重新輸入!", , "登錄提示信息:" Text1.Text = "" Text2.Text = "" Text1.SetFocus Exit

9、 Sub End If Form1.Hide 'Unload Me Form2.Show 'MsgBox "登陸成功!", , "登錄提示信息:" Else MsgBox "密碼不正確,請重新輸入!", , "登錄提示信息:" Text2.Text = "" Text2.SetFocus End If End IfEnd SubPrivate Sub Command2_Click() '“退出”或“取消”按鈕 If Command2.Caption = "取消&

10、quot; Then Label3.Visible = False Text3.Visible = False Command1.Caption = "登錄" Command2.Caption = "退出" Text1.Text = "" Text2.Text = "" Text1.SetFocus Else End 'Unload Me End IfEnd SubPrivate Sub Command3_Click() '“新用戶”按鈕 Label3.Visible = True Text3.Vi

11、sible = True Text1.Text = "" Text2.Text = "" Text3.Text = "" Command1.Caption = "確定" Command2.Caption = "取消" Text1.SetFocusEnd SubPrivate Sub Command3_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) Label6.Visible = TrueEnd S

12、ubPrivate Sub Command3_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) Label6.Visible = FalseEnd SubPrivate Sub Form_Load() Label3.Visible = False Text3.Visible = FalseEnd SubPrivate Sub Timer1_Timer() '時間time1控件的time事件代碼,用來 '顯示向左移動的歡迎字幕 If Label4.Left + Label4.Width &

13、gt; 0 Then '當標簽右邊位置大于0時,標簽向左移 Label4.Move Label4.Left - 80 Else '否則標簽從頭開始 Label4.Left = Form1.ScaleWidth End If If Label5.Left + Label5.Width > 0 Then Label5.Move Label5.Left - 80 Else Label5.Left = Form1.ScaleWidth End IfEnd Sub主界面窗體如下:代碼: Private Sub AddNew_Click() Frame1.Visible = True

14、 Frame2.Visible = FalseEnd SubPrivate Sub CHKPMCHX_Click() Frame2.Caption = "出庫信息" Dim pm As String Dim n As String pm = InputBox("產品名", "請輸入", 0) n = "select * from 出庫表 where 品名 = '" & pm & "'" Adodc2.CommandType = adCmdText Adodc2.R

15、ecordSource = n Adodc2.Refresh Call InitGrid1End SubPrivate Sub CHKXHCHX_Click() Frame2.Caption = "出庫信息" Dim XH As String Dim n As String XH = InputBox("產品型號", "請輸入", 0) n = "select * from 出庫表 where 型號 = '" & XH & "'" Adodc2.CommandTy

16、pe = adCmdText Adodc2.RecordSource = n Adodc2.RefreshEnd SubPrivate Sub CKCZ_Click() 'Form2.Hide Form6.ShowEnd SubPrivate Sub CKJSHR_Click() Frame2.Caption = "出庫信息" Dim JSHR As String Dim n As String JSHR = InputBox("經手人", "請輸入", 0) n = "select * from 出庫表 where

17、 經手人 = '" & JSHR & "'" Adodc2.CommandType = adCmdText Adodc2.RecordSource = n Adodc2.Refresh Call InitGrid1End SubPrivate Sub CKSHJ_Click() Frame2.Caption = "出庫信息" Dim CHKRQ As String Dim n As String CHKRQ = InputBox("出庫日期,格式為:月/日/年 如:12/1/2011", &q

18、uot;請輸入", 0) n = "select * from 出庫表 where 出庫日期 = '" & CHKRQ & "'" Adodc2.CommandType = adCmdText Adodc2.RecordSource = n Adodc2.Refresh Call InitGrid1End SubPrivate Sub CKZCX_Click() Frame2.Caption = "出庫信息" Dim ZB As String ZB = "select * from

19、出庫表 " Adodc2.CommandType = adCmdText Adodc2.RecordSource = ZB Adodc2.Refresh Call InitGrid1End SubPrivate Sub Command1_Click() If Text1.Text = "" Then '提示用戶輸入用戶名 MsgBox "請輸入用戶名!", , "登錄信息提示:" Exit Sub Else ' Dim usename As String '檢測用戶名是否已經存在 Dim strS A

20、s String usename = Trim(Text1.Text) strS = "select * from 用戶登錄信息表 where 用戶名='" & usename & "'" Adodc1.CommandType = adCmdText Adodc1.RecordSource = strS Adodc1.Refresh MsgBox "您輸入的用戶已存在!", , "登錄提示信息:" Text1.Text = "" Text2.Text = &quo

21、t;" Text3.Text = "" Text1.SetFocus Exit Sub End If End If If Text2.Text = "" Then '提示用戶密碼不能為空 MsgBox "密碼不能為空!", , "登錄提示信息:" Text2.SetFocus Exit Sub End If If Text3.Text = "" Then MsgBox "請再次輸入密碼!", , "登錄提示信息:" Text3.SetFo

22、cus Exit Sub End If If Text2.Text <> Text3.Text Then MsgBox "兩次輸入的密碼不一致,請確認!", , "登錄提示信息:" Text2.Text = "" Text3.Text = "" Text2.SetFocus Exit Sub Elsee Dim X As Integer X = MsgBox("成功添加新用戶,是否要重新登錄!", vbYesNo + vbQuestion + vbDefaultButton1, &q

23、uot;提示信息!") If X = vbYes Then Unload Me Form3.Show End If 'MsgBox ("成功添加新用戶!") 'Label3.Visible = False 'Text3.Visible = False 'Command1.Caption = "登錄" 'Command2.Caption = "退出" End If Frame1.Visible = False Frame2.Visible = True Text1.Text = &quo

24、t;" Text2.Text = "'" Text3.Text = "" 'Form3.ShowEnd SubPrivate Sub Command2_Click() Frame1.Visible = False Frame2.Visible = TrueEnd SubPrivate Sub CXDL_Click() Form3.Show 'Unload MeEnd SubPrivate Sub Exit_Click() End Unload Form1 Unload Form2 Unload Form3 Unload

25、Form4 Unload Form5 Unload Form6 Unload Form7 Unload Form8End SubPrivate Sub Form_Load() Unload Form1 Frame1.Visible = False Call InitGrid0 Me.Height = MDIForm1.Height - 1060 Me.Width = MDIForm1.Width - 560 Me.Top = MDIForm1.Top Me.Left = MDIForm1.LeftEnd SubPrivate Sub GHCZ_Click() 'Form2.Hide F

26、orm8.ShowEnd SubPrivate Sub GHPMCX_Click() Frame2.Caption = "歸還信息" Dim pm As String Dim n As String pm = InputBox("產品名", "請輸入", 0) n = "select * from 歸還表 where 品名 = '" & pm & "'" Adodc2.CommandType = adCmdText Adodc2.RecordSource = n

27、Adodc2.Refresh Call InitGrid2End SubPrivate Sub GHRCX_Click() Frame2.Caption = "歸還信息" Dim JCR As String Dim n As String JCR = InputBox("歸還人", "請輸入", 0) n = "select * from 歸還表 where 歸還人 = '" & JCR & "'" Adodc2.CommandType = adCmdText A

28、dodc2.RecordSource = n Adodc2.Refresh Call InitGrid2End SubPrivate Sub GHSJCX_Click() Frame2.Caption = "歸還信息" Dim JCRQ As String Dim n As String JCRQ = InputBox("歸還日期,格式為:月/日/年 如:12/1/2011", "請輸入", 0) n = "select * from 歸還表 where 歸還日期 = '" & JCRQ &

29、 "'" Adodc2.CommandType = adCmdText Adodc2.RecordSource = n Adodc2.Refresh Call InitGrid2End SubPrivate Sub GHXHCX_Click() Frame2.Caption = "歸還信息" Dim XH As String Dim n As String XH = InputBox("產品型號", "請輸入", 0) n = "select * from 歸還表 where 型號 = '

30、" & XH & "'" Adodc2.CommandType = adCmdText Adodc2.RecordSource = n Adodc2.Refresh Call InitGrid2End SubPrivate Sub GHZCX_Click() Frame2.Caption = "歸還信息" Dim ZB As String ZB = "select * from 歸還表 " Adodc2.CommandType = adCmdText Adodc2.RecordSource = ZB

31、Adodc2.Refresh Call InitGrid2End SubPrivate Sub JCCZ_Click() 'Form2.Hide Form7.ShowEnd SubPrivate Sub JCHPMCHX_Click() Frame2.Caption = "借出信息" Dim pm As String Dim n As String pm = InputBox("產品名", "請輸入", 0) n = "select * from 借出表 where 品名 = '" & pm

32、 & "'" Adodc2.CommandType = adCmdText Adodc2.RecordSource = n Adodc2.Refresh Call InitGrid2End SubPrivate Sub JCHXHCHX_Click() Frame2.Caption = "借出信息" Dim XH As String Dim n As String XH = InputBox("產品型號", "請輸入", 0) n = "select * from 借出表 where 型號

33、 = '" & XH & "'" Adodc2.CommandType = adCmdText Adodc2.RecordSource = n Adodc2.Refresh Call InitGrid2End SubPrivate Sub JCRCX_Click() Frame2.Caption = "借出信息" Dim JCR As String Dim n As String JCR = InputBox("借出人", "請輸入", 0) n = "selec

34、t * from 借出表 where 借出人 = '" & JCR & "'" Adodc2.CommandType = adCmdText Adodc2.RecordSource = n Adodc2.Refresh Call InitGrid2End SubPrivate Sub JCSHJCX_Click() Frame2.Caption = "借出信息" Dim JCRQ As String Dim n As String JCRQ = InputBox("借出日期,格式為:月/日/年 如:12

35、/1/2011", "請輸入", 0) n = "select * from 借出表 where 借出日期 = '" & JCRQ & "'" Adodc2.CommandType = adCmdText Adodc2.RecordSource = n Adodc2.Refresh Call InitGrid2End SubPrivate Sub JCZCX_Click() Frame2.Caption = "借出信息" Dim ZB As String ZB = &quo

36、t;select * from 借出表 " Adodc2.CommandType = adCmdText Adodc2.RecordSource = ZB Adodc2.Refresh Call InitGrid2End SubPrivate Sub JSHRCHX_Click() Frame2.Caption = "歸還信息" Dim JSHR As String Dim n As String JSHR = InputBox("經手人", "請輸入", 0) n = "select * from 歸還表 whe

37、re 經手人 = '" & JSHR & "'" Adodc2.CommandType = adCmdText Adodc2.RecordSource = n Adodc2.Refresh Call InitGrid2End SubPrivate Sub JSHRCX_Click() Frame2.Caption = "借出信息" Dim JSHR As String Dim n As String JSHR = InputBox("經手人", "請輸入", 0) n =

38、"select * from 借出表 where 經手人 = '" & JSHR & "'" Adodc2.CommandType = adCmdText Adodc2.RecordSource = n Adodc2.Refresh Call InitGrid2End SubPrivate Sub PMCX_Click() Frame2.Caption = "庫存信息" Dim pm As String Dim n As String pm = InputBox("產品名", &qu

39、ot;請輸入", 0) n = "select * from 庫存表 where 品名 = '" & pm & "'" Adodc2.CommandType = adCmdText Adodc2.RecordSource = n Adodc2.Refresh Call InitGrid0End SubPrivate Sub RKCZ_Click() 'Form2.Hide Form5.ShowEnd SubPrivate Sub RKJSHR_Click() Frame2.Caption = "

40、入庫信息" Dim JSHR As String Dim n As String JSHR = InputBox("經手人", "請輸入", 0) n = "select * from 入庫表 where 經手人 = '" & JSHR & "'" Adodc2.CommandType = adCmdText Adodc2.RecordSource = n Adodc2.Refresh Call InitGrid1End SubPrivate Sub RKPMCHX_Cli

41、ck() Frame2.Caption = "入庫信息" Dim pm As String Dim n As String pm = InputBox("產品名", "請輸入", 0) If Len(pm) > 0 Then n = "select * from 入庫表 where 品名 = '" & pm & "'" Adodc2.CommandType = adCmdText Adodc2.RecordSource = n Adodc2.Refresh

42、End If Call InitGrid1End SubPrivate Sub RKSHJ_Click() Frame2.Caption = "入庫信息" Dim RKRQ As String Dim n As String RKRQ = InputBox("入庫日期,格式為:月/日/年 如:12/1/2011", "請輸入", 0) n = "select * from 入庫表 where 入庫日期 = '" & RKRQ & "'" Adodc2.Comman

43、dType = adCmdText Adodc2.RecordSource = n Adodc2.Refresh Call InitGrid1End SubPrivate Sub RKXHCHX_Click() Frame2.Caption = "入庫信息" Dim XH As String Dim n As String XH = InputBox("產品型號", "請輸入", 0) If Len(XH) > 0 Then n = "select * from 入庫表 where 型號 = '" &

44、amp; XH & "'" Adodc2.CommandType = adCmdText Adodc2.RecordSource = n Adodc2.Refresh End If Call InitGrid1End SubPrivate Sub RKZCX_Click() Frame2.Caption = "入庫信息" Dim ZB As String ZB = "select * from 入庫表 " Adodc2.CommandType = adCmdText Adodc2.RecordSource = ZB A

45、dodc2.Refresh Call InitGrid1End SubPrivate Sub Timer1_Timer() If Label4.Left + Label4.Width > 0 Then '當標簽右邊位置大于0時,標簽向左移 Label4.Move Label4.Left - 80 Else '否則標簽從頭開始 Label4.Left = Form2.ScaleWidth End If If Label5.Left + Label5.Width > 0 Then Label5.Move Label5.Left - 80 Else Label5.Left

46、 = Form2.ScaleWidth End If If Label6.Left + Label6.Width > 0 Then Label6.Move Label6.Left - 80 Else Label6.Left = Form2.ScaleWidth End If If Label7.Left + Label7.Width > 0 Then Label7.Move Label7.Left - 80 Else Label7.Left = Form2.ScaleWidth End IfEnd SubPrivate Sub XGMM_Click() 'Form2.Hid

47、e Form4.ShowEnd SubPrivate Sub XHCX_Click() Frame2.Caption = "庫存信息" Dim XH As String Dim n As String XH = InputBox("產品型號", "請輸入", 0) If Len(XH) > 0 Then 'And Val(XH) <> 0 n = "select * from 庫存表 where 型號 = '" & XH & "'" Ad

48、odc2.CommandType = adCmdText Adodc2.RecordSource = n Adodc2.Refresh End If Call InitGrid0End SubPrivate Sub ZB_Click() Frame2.Caption = "庫存信息" Dim ZB As String 'Dim N As String 'PM = InputBox("產品名", "請輸入", 0) ZB = "select * from 庫存表 " 'where 品名 = &

49、#39;" & PM & "'" Adodc2.CommandType = adCmdText Adodc2.RecordSource = ZB Adodc2.Refresh Call InitGrid0End SubPrivate Sub InitGrid0() With DataGrid1 .Columns(0).Width = 1600 .Columns(1).Width = 2200 .Columns(2).Width = 2200 .Columns(3).Width = 1000 .Columns(4).Width = 1000

50、.Columns(5).Width = 4000 End WithEnd SubPrivate Sub InitGrid1() With DataGrid1 .Columns(0).Width = 800 .Columns(1).Width = 1600 .Columns(2).Width = 1600 .Columns(3).Width = 800 .Columns(4).Width = 800 .Columns(5).Width = 1000 .Columns(6).Width = 800 .Columns(7).Width = 4000 End WithEnd SubPrivate Su

51、b InitGrid2() With DataGrid1 '.Columns(0).Caption = "學號" ' .Columns(1).Caption = "課程名" '.Columns(2).Caption = "學分" ' .Columns(3).Caption = "成績" '設置DtgCond的列寬 .Columns(0).Width = 800 .Columns(1).Width = 1600 .Columns(2).Width = 1600 .Columns

52、(3).Width = 800 .Columns(4).Width = 800 .Columns(5).Width = 800 .Columns(6).Width = 1000 .Columns(7).Width = 800 .Columns(8).Width = 4000 End WithEnd Sub用戶重新登錄界面 代碼: Private Sub Command1_Click() Dim strSno As String Dim strSelect As String strSno = Trim(Text1.Text) '檢測用戶名是否存在 strSelect = "s

53、elect 密碼 from 用戶登錄信息表 where 用戶名 = '" & strSno & "'" Adodc1.CommandType = adCmdText Adodc1.RecordSource = strSelect Adodc1.Refresh MsgBox "用戶名不存在,請重新輸入!", , "登錄提示信息:" Text1.Text = "" Text2.Text = "" Text1.SetFocus Exit Sub End If

54、Unload Me Form2.Show 'MsgBox "登陸成功!", , "登錄提示信息:" Else MsgBox "密碼不正確,請重新輸入!", , "登錄提示信息:" Text2.Text = "" Text2.SetFocus End IfEnd SubPrivate Sub Command2_Click() Unload Me Form2.ShowEnd Sub修改用戶密碼界面代碼: Private Sub Command1_Click() If Trim(Text1.T

55、ext) <> Form2.TextUserName Then MsgBox "用戶名不正確,請確認!", , "信息提示!" Text1.Text = "" Text1.SetFocus Exit Sub Else Dim name As String Dim names As String name = Trim(Text1.Text) names = "select * from 用戶登錄信息表 where 用戶名='" & name & "'"

56、 Adodc1.CommandType = adCmdText Adodc1.RecordSource = names Adodc1.Refresh If Text2.Text = "" Then MsgBox "請輸入舊密碼!", , "信息提示!" Text2.SetFocus Exit Sub End If MsgBox "舊密碼不正確,請確認!", , "信息提示!" Text2.Text = "" Text2.SetFocus Exit Sub End If If Text3.Text = "" Then MsgBox "請輸入新密碼!", , "信息提示!" Text3.SetFocus Exit Sub End If If Text4.Text = "" Then MsgBox "請再次輸入新密碼!", , "信息提示!" Text4.SetFocus Exit S

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論