?? form4.frm
字號:
VERSION 5.00
Begin VB.Form Form4
Caption = "藥品出庫"
ClientHeight = 5760
ClientLeft = 3945
ClientTop = 2205
ClientWidth = 7680
LinkTopic = "Form4"
Picture = "Form4.frx":0000
ScaleHeight = 5760
ScaleWidth = 7680
Begin VB.CommandButton Command2
Caption = "退出"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 4800
TabIndex = 7
Top = 4920
Width = 1095
End
Begin VB.ComboBox Combo2
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
ItemData = "Form4.frx":20FE
Left = 4920
List = "Form4.frx":2100
TabIndex = 6
Top = 2280
Width = 2295
End
Begin VB.TextBox Text4
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 4920
TabIndex = 5
Top = 3480
Width = 2295
End
Begin VB.ComboBox Combo1
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
ItemData = "Form4.frx":2102
Left = 4920
List = "Form4.frx":2118
TabIndex = 2
Top = 1080
Width = 2295
End
Begin VB.CommandButton Command1
Caption = "確定"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1680
TabIndex = 0
Top = 4920
Width = 1095
End
Begin VB.Label Label5
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "輸入出庫數(shù)量:"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 1080
TabIndex = 4
Top = 3600
Width = 1680
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "選擇藥品入庫批號:"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 600
TabIndex = 3
Top = 2280
Width = 2160
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "選擇出庫藥品名稱:"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 600
TabIndex = 1
Top = 1080
Width = 2160
End
End
Attribute VB_Name = "Form4"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Combo1_LostFocus()
Combo2.SetFocus
End Sub
Private Sub Combo2_GotFocus()
Dim rs As New ADODB.Recordset
Dim sql As String
If Combo1.Text = "" Then
MsgBox "請輸入出庫的藥品名!", vbOKOnly + vbExclamation, "警告!"
Combo1.SetFocus
Else
sql = "select * from 藥品庫存表 where 藥品名稱='" & Combo1.Text & "'"
rs.Open sql, con, adOpenKeyset, adLockPessimistic
If (rs.RecordCount <= 0) Then
MsgBox "暫時沒有該藥品!", vbOKOnly + vbExclamation, "警告!"
Combo1.SetFocus
Else
Do While Not rs.EOF
Combo2.AddItem rs.Fields(0)
rs.MoveNext
Loop
rs.Close
End If
End If
End Sub
Private Sub Command1_Click()
Dim rs As New ADODB.Recordset
Dim sql As String
Dim rs2 As New ADODB.Recordset
Dim sql2 As String
If Combo1.Text = "" Then
MsgBox "請輸入出庫藥品名!", vbOKOnly + vbExclamation, "警告!"
Combo1.SetFocus
Else
If Combo2.Text = "" Then
MsgBox "請輸入進庫編號!", vbOKOnly + vbExclamation, "警告!"
Combo1.SetFocus
Else
If Text4.Text = "" Or (Not IsNumeric(Text4.Text)) Then
MsgBox "出庫數(shù)量必須非空且為數(shù)字型!", vbOKOnly + vbExclamation, "警告!"
Text4.SetFocus
Else
sql = "select * from 藥品庫存表 where 進庫編號='" & (Combo2.Text) & "'"
rs.CursorLocation = adUseClient
rs.Open sql, con, adOpenKeyset, adLockPessimistic
Do While (Text4.Text = "" Or rs.Fields(4).Value < Val(Text4.Text))
Text4.Text = InputBox("庫存數(shù)量不夠,重新選擇出庫量", "重新選擇!")
Loop
rs.Fields(4) = rs.Fields(4) - Text4.Text
rs.Update
sql2 = "select * from 出庫記錄表"
rs2.Open sql2, con, adOpenKeyset, adLockPessimistic
rs2.AddNew
rs2.Fields(1) = Combo1.Text
rs2.Fields(2) = Text4.Text
rs2.Fields(3) = Date
rs2.Fields(4) = rs.Fields(3)
rs2.Update
End If
End If
End If
MsgBox "藥品出庫操作已完成!", vbOKOnly + vbExclamation, "恭喜!"
Unload Me
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -