?? 1.txt
字號:
Private Sub Command1_Click()
If Val(Label4.Caption) - Val(Text1.Text) < 0 Then
MsgBox "庫存量不夠!請及時采購。"
Exit Sub
End If
If DBCombo2.Text = "" Then
MsgBox "請選擇出庫材料名稱!"
Exit Sub
End If
If DBCombo4.Text = "" Then
MsgBox "請選擇經手人!"
Exit Sub
End If
Dim a As Integer
a = MsgBox("********你確定此操作嗎?**********" & vbCrLf _
& "材料名稱:" & DBCombo2.Text & vbCrLf _
& "原庫存量:" & Label4.Caption & Label5.Caption & vbCrLf _
& "本次出庫:" & Text1.Text & Label5.Caption & vbCrLf _
& "服務客戶:" & DBCombo3.Text & vbCrLf _
& "經手人:" & DBCombo4.Text & vbCrLf _
, vbExclamation + vbOKCancel + vbApplicationModal, "提示")
If a = 1 Then
Data5.Recordset.AddNew
Data5.Recordset("名稱") = DBCombo2.Text
Data5.Recordset("用途") = DBCombo3.Text
Data5.Recordset("數量") = Text1.Text
Data5.Recordset("經手人") = DBCombo4.Text
Data5.Recordset("日期") = Date
Data5.Recordset("時間") = Time
Data5.UpdateRecord
Data5.Recordset.Bookmark = Data5.Recordset.LastModified
'************************
Data2.Recordset.Edit
Data2.Recordset("數量") = Val(Label4.Caption) - Val(Text1.Text)
Data2.Recordset.Update
MsgBox "出庫完成!"
' asPopup4.Enabled = True
End If
End Sub
Private Sub Command2_Click()
DataReport1.Show
DataReport1.Sections(2).Controls("Label1").Caption = "出庫單據"
DataReport1.Sections(2).Controls("Label2").Caption = CStr(DBCombo2.Text)
DataReport1.Sections(2).Controls("Label3").Caption = "數量:" & CStr(Text1.Text)
DataReport1.Sections(2).Controls("Label4").Caption = "用途:" & CStr(DBCombo3.Text)
DataReport1.Sections(2).Controls("Label5").Caption = ""
DataReport1.Sections(2).Controls("Label6").Caption = "經手人:" & CStr(DBCombo4.Text)
DataReport1.Sections(2).Controls("Label7").Caption = "時間:" & CStr(Date) & " " & CStr(Time) & " " & CStr(Data5.Recordset("ID"))
'asPopup4.Enabled = False
End Sub
Private Sub DBCombo2_Click(Area As Integer)
If DBCombo1.Text = "" Then
MsgBox "請先選擇類別!"
Exit Sub
End If
Dim SQL As String
SQL = "SELECT ID, 分類, 單位, 名稱, 備注, 數量 FROM 庫存材料表 WHERE 分類 = '" & CStr(DBCombo1.Text) & "'"
Data2.Visible = False
Data2.DatabaseName = App.Path & "\庫存管理.mdb"
Data2.RecordSource = SQL
Data2.Refresh
DBCombo2.Refresh
Timer1.Enabled = True
Timer1.Interval = 2000
End Sub
Private Sub DBCombo3_Click(Area As Integer)
Timer2.Enabled = True
Timer2.Interval = 2000
End Sub
Private Sub DBCombo4_Click(Area As Integer)
Timer3.Enabled = True
Timer3.Interval = 2000
End Sub
Private Sub Form_Load()
MakeWindow Me
' AlwaysOnTop Me, True
Me.Top = MDIFrmMain.Height / 2 - Me.Height / 2 - 1000
Me.Left = MDIFrmMain.Width / 2 - Me.Width / 2
Data1.DatabaseName = App.Path & "\庫存管理.mdb"
Data1.Connect = ";pwd=lee1012"
Data1.RecordSource = "材料分類表"
Data1.Refresh
Data1.Visible = False
Data2.DatabaseName = App.Path & "\庫存管理.mdb"
Data2.Connect = ";pwd=lee1012"
Data2.RecordSource = "庫存材料表"
Data2.Refresh
Data2.Visible = False
Data3.DatabaseName = App.Path & "\庫存管理.mdb"
Data3.Connect = ";pwd=lee1012"
Data3.RecordSource = "客戶表"
Data3.Refresh
Data3.Visible = False
Data4.DatabaseName = App.Path & "\庫存管理.mdb"
Data4.Connect = ";pwd=lee1012"
Data4.RecordSource = "員工表"
Data4.Refresh
Data4.Visible = False
Data5.DatabaseName = App.Path & "\庫存管理.mdb"
Data5.Connect = ";pwd=lee1012"
Data5.RecordSource = "出庫表"
Data5.Refresh
Data5.Visible = False
'asPopup4.Enabled = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
Dim MyStr As String
MyStr = "通用庫存管理"
MDIFrmMain.MovingText1.MsgChar = MyStr
End Sub
Private Sub imgTitleClose_Click()
Unload Me
End Sub
Private Sub imgTitleLeft_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
DoDrag Me
End Sub
Private Sub imgTitleMain_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
DoDrag Me
End Sub
Private Sub imgTitleMinimize_Click()
Me.WindowState = 1
End Sub
Private Sub imgTitleRight_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
DoDrag Me
End Sub
Private Sub lblTitle_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
DoDrag Me
End Sub
Private Sub Timer1_Timer()
Data2.Recordset.FindFirst "名稱 ='" & DBCombo2.Text & "'"
If Data2.Recordset.NoMatch = True Then
MsgBox "Err", 0, "提示"
Timer1.Enabled = False
Exit Sub
Timer1.Enabled = False
End If
Label4.Caption = Data2.Recordset("數量")
Label5.Caption = Data2.Recordset("單位")
Timer1.Enabled = False
Dim MyStr As String
MyStr = CStr(DBCombo2.Text) & " 原庫存量" & CStr(Label4.Caption) & CStr(Label5.Caption)
MDIFrmMain.MovingText1.MsgChar = MyStr
End Sub
Private Sub Timer2_Timer()
If DBCombo3.Text = "" Then
MsgBox "沒有選擇服務客戶!"
Timer2.Enabled = False
Exit Sub
End If
Data3.Recordset.FindFirst "名稱 ='" & DBCombo3.Text & "'"
If Data3.Recordset.NoMatch = True Then
MsgBox "Err", 0, "提示"
Timer2.Enabled = False
Exit Sub
End If
Dim MyStr As String
MyStr = CStr(Data3.Recordset("名稱")) & " 地址:" & CStr(Data3.Recordset("地址")) & " 聯系人:" & CStr(Data3.Recordset("聯系人")) & " 電話:" & CStr(Data3.Recordset("電話")) & " 需求產品:" & CStr(Data3.Recordset("產品")) & " 數量:" & CStr(Data3.Recordset("數量")) & " 備注:" & CStr(Data3.Recordset("備注"))
MDIFrmMain.MovingText1.MsgChar = MyStr
Timer2.Enabled = False
End Sub
Private Sub Timer3_Timer()
If DBCombo4.Text = "" Then
MsgBox "沒有選擇供應商!"
Timer3.Enabled = False
Exit Sub
End If
Data4.Recordset.FindFirst "姓名 ='" & DBCombo4.Text & "'"
If Data4.Recordset.NoMatch = True Then
MsgBox "Err", 0, "提示"
Timer3.Enabled = False
Exit Sub
End If
Dim MyStr As String
MyStr = CStr(Data4.Recordset("姓名")) & " 職務:" & CStr(Data4.Recordset("職務")) & " 電話:" & CStr(Data4.Recordset("電話"))
MDIFrmMain.MovingText1.MsgChar = MyStr
Timer3.Enabled = False
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -