📄 frm_standard_add.frm
字号:
VERSION 5.00
Begin VB.Form Frm_Standard_Add
BorderStyle = 1 'Fixed Single
Caption = "药品信息添加"
ClientHeight = 2715
ClientLeft = 3495
ClientTop = 2835
ClientWidth = 5925
Icon = "Frm_Standard_Add.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2715
ScaleWidth = 5925
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 3480
TabIndex = 17
Top = 2100
Width = 1155
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 1140
TabIndex = 16
Top = 2100
Width = 1155
End
Begin VB.ComboBox Combo1
Height = 300
Left = 3840
Style = 2 'Dropdown List
TabIndex = 15
Top = 240
Width = 1815
End
Begin VB.TextBox Text8
Height = 300
Left = 3840
TabIndex = 14
Top = 1500
Width = 1815
End
Begin VB.TextBox Text7
Height = 300
Left = 900
TabIndex = 12
Top = 1500
Width = 1815
End
Begin VB.TextBox Text6
Height = 300
Left = 3840
TabIndex = 10
Top = 1080
Width = 1815
End
Begin VB.TextBox Text5
Height = 300
Left = 900
TabIndex = 8
Top = 1080
Width = 1815
End
Begin VB.TextBox Text4
Height = 300
Left = 3840
TabIndex = 6
Top = 660
Width = 1815
End
Begin VB.TextBox Text3
Height = 300
Left = 900
TabIndex = 4
Top = 660
Width = 1815
End
Begin VB.TextBox Text1
Height = 300
Left = 900
TabIndex = 1
Top = 240
Width = 1815
End
Begin VB.Label Label8
Caption = "出 价"
Height = 315
Left = 3060
TabIndex = 13
Top = 1560
Width = 555
End
Begin VB.Label Label7
Caption = "进 价"
Height = 255
Left = 300
TabIndex = 11
Top = 1560
Width = 495
End
Begin VB.Label Label6
Caption = "单 位"
Height = 315
Left = 3060
TabIndex = 9
Top = 1140
Width = 555
End
Begin VB.Label Label5
Caption = "包 装"
Height = 195
Left = 300
TabIndex = 7
Top = 1140
Width = 555
End
Begin VB.Label Label4
Caption = "规 格"
Height = 315
Left = 3060
TabIndex = 5
Top = 720
Width = 555
End
Begin VB.Label Label3
Caption = "药 种"
Height = 315
Left = 300
TabIndex = 3
Top = 720
Width = 555
End
Begin VB.Label Label2
Caption = "供应商"
Height = 255
Left = 3060
TabIndex = 2
Top = 300
Width = 675
End
Begin VB.Label Label1
Caption = "药 名"
Height = 315
Left = 300
TabIndex = 0
Top = 300
Width = 495
End
End
Attribute VB_Name = "Frm_Standard_Add"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
On Error GoTo myerr
Dim cn As ADODB.Connection
Dim rst As New ADODB.Recordset
If Trim(Text1) = "" Then
MsgBox "药名不能为空!", vbExclamation, "提示"
Text1.SetFocus
Exit Sub
End If
If Trim(Text3) = "" Then
MsgBox "药种不能为空!", vbExclamation, "提示"
Text3.SetFocus
Exit Sub
End If
If Trim(Text4) = "" Then
MsgBox "规格不能为空!", vbExclamation, "提示"
Text4.SetFocus
Exit Sub
End If
If Trim(Text5) = "" Then
MsgBox "包装不能为空!", vbExclamation, "提示"
Text5.SetFocus
Exit Sub
End If
If Trim(Text6) = "" Then
MsgBox "单位不能为空!", vbExclamation, "提示"
Text6.SetFocus
Exit Sub
End If
If Not IsNumeric(Text7) Then
MsgBox "请正确输入进价!", vbExclamation, "提示"
Text7.SetFocus
Exit Sub
End If
If Not IsNumeric(Text8) Then
MsgBox "请正确输入出价!", vbExclamation, "提示"
Text8.SetFocus
Exit Sub
End If
If Len(Text1) > 50 Then
MsgBox "药名超长!", vbExclamation, "提示"
Text1.SetFocus
Exit Sub
End If
If Len(Text3) > 50 Then
MsgBox "药种超长!", vbExclamation, "提示"
Text3.SetFocus
Exit Sub
End If
If Len(Text4) > 50 Then
MsgBox "规格超长!", vbExclamation, "提示"
Text4.SetFocus
Exit Sub
End If
If Len(Text5) > 50 Then
MsgBox "包装超长!", vbExclamation, "提示"
Text5.SetFocus
Exit Sub
End If
If Len(Text6) > 10 Then
MsgBox "单位超长!", vbExclamation, "提示"
Text6.SetFocus
Exit Sub
End If
Set cn = GetCn
cn.Execute "insert into standard (name,supply_id,model,normal,packing,unit,in_price,out_price) values ('" & Text1 & "'," & Combo1.ItemData(Combo1.ListIndex) & ",'" & Text3 & "','" & Text4 & "','" & Text5 & "','" & Text6 & "'," & Text7 & "," & Text8 & ")"
MsgBox "已成功保存!", vbExclamation, "提示"
Unload Me
Exit Sub
myerr:
MsgBox Error, vbExclamation, "提示"
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim cn As ADODB.Connection
Dim rst As New ADODB.Recordset
Set cn = GetCn
rst.Open "select short_name,supply_id from supply where stop=0", cn, 0, 1
If rst.BOF And rst.EOF Then
MsgBox "请先维护供应商信息!", vbExclamation, "提示"
Command1.Enabled = False
rst.Close
cn.Close
Exit Sub
End If
Combo1.Clear
Do While Not rst.EOF
Combo1.AddItem rst(0)
Combo1.ItemData(Combo1.NewIndex) = rst(1)
rst.MoveNext
Loop
Combo1.ListIndex = 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -