📄 药品信息.frm
字号:
DataSource = "Adodc1"
Height = 375
Left = 2280
TabIndex = 17
Top = 2940
Width = 3435
End
Begin VB.TextBox Text10
DataField = "单位"
DataSource = "Adodc1"
Height = 375
Left = 2280
TabIndex = 16
Top = 2580
Width = 3435
End
Begin VB.TextBox Text9
DataField = "库存量"
DataSource = "Adodc1"
Height = 375
Left = 2280
TabIndex = 15
Top = 2220
Width = 3435
End
Begin VB.TextBox Text8
DataField = "厂价"
DataSource = "Adodc1"
Height = 375
Left = 2280
TabIndex = 14
Top = 1860
Width = 3435
End
Begin VB.TextBox Text7
DataField = "售价"
DataSource = "Adodc1"
Height = 375
Left = 2280
TabIndex = 13
Top = 1500
Width = 3435
End
Begin VB.TextBox Text6
DataField = "药品类别代码"
DataSource = "Adodc1"
Height = 375
Left = 2280
TabIndex = 12
Top = 1140
Width = 3435
End
Begin VB.TextBox Text5
DataField = "药品名称"
DataSource = "Adodc1"
Height = 375
Left = 2280
TabIndex = 11
Top = 780
Width = 3435
End
Begin VB.TextBox Text4
DataField = "药品编码"
DataSource = "Adodc1"
Height = 375
Left = 2280
TabIndex = 10
Top = 420
Width = 3435
End
Begin VB.CommandButton Command1
Caption = "新增"
Height = 435
Left = 300
TabIndex = 0
Top = 4080
Width = 1395
End
Begin VB.Label Label12
Caption = "批准文号:"
Height = 255
Left = 360
TabIndex = 9
Top = 3360
Width = 1875
End
Begin VB.Label Label11
Caption = "有效期至:"
Height = 255
Left = 360
TabIndex = 8
Top = 3000
Width = 1875
End
Begin VB.Label Label10
Caption = "单位:"
Height = 255
Left = 360
TabIndex = 7
Top = 2640
Width = 1875
End
Begin VB.Label Label9
Caption = "现存数量:"
Height = 255
Left = 360
TabIndex = 6
Top = 2280
Width = 1875
End
Begin VB.Label Label8
Caption = "厂价:"
Height = 255
Left = 360
TabIndex = 5
Top = 1920
Width = 1875
End
Begin VB.Label Label7
Caption = "售价:"
Height = 255
Left = 360
TabIndex = 4
Top = 1560
Width = 1875
End
Begin VB.Label Label6
Caption = "药品类别代码:"
Height = 255
Left = 360
TabIndex = 3
Top = 1200
Width = 1875
End
Begin VB.Label Label5
Caption = "药品名称:"
Height = 255
Left = 360
TabIndex = 2
Top = 840
Width = 1875
End
Begin VB.Label Label4
Caption = "药品编码:"
Height = 255
Left = 360
TabIndex = 1
Top = 480
Width = 1875
End
End
Attribute VB_Name = "药品信息"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
On Error Resume Next
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = True
Command5.Enabled = False
If Command1.Caption = "新增" Then
Command1.Caption = "确认"
Adodc1.Recordset.AddNew
Text4.SetFocus
Else
Command1.Caption = "新增"
Adodc1.Recordset.Update
Adodc1.Recordset.MoveLast
Command2.Enabled = True
Command3.Enabled = True
Command5.Enabled = True
End If
End Sub
Private Sub Command2_Click()
On Error Resume Next
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF Then Adodc1.Recordset.MoveLast
End Sub
Private Sub Command3_Click()
On Error Resume Next
Command1.Enabled = False
Command2.Enabled = False
Command4.Enabled = True
Command5.Enabled = False
If Command3.Caption = "修改" Then
Command3.Caption = "确认"
Adodc1.Recordset.Update
Text4.SetFocus
Else
Command3.Caption = "修改"
Adodc1.Recordset.Update
Command1.Enabled = True
Command2.Enabled = True
Command5.Enabled = True
End If
End Sub
Private Sub Command4_Click()
Command1.Enabled = True: Command2.Enabled = True
Command3.Enabled = True: Command4.Enabled = False
Command5.Enabled = True: Command3.Caption = "修改"
Command1.Caption = "添加"
On Error GoTo RefreshErr
Adodc1.Refresh
Exit Sub
RefreshErr:
MsgBox Err.Description
End Sub
Private Sub Command5_Click()
Frame1.Visible = True
End Sub
Private Sub Command6_Click()
If Option1 Then
Adodc1.RecordSource = "select medicinecode as 药品编码,medicinename as 药品名称,medkindcode as 药品类别代码,price as 售价,listprice as 厂价,stocknum as 库存量,unit as 单位,usefullife as 有效期至,ratifycode as 批准文号 from MedInfor where medicinecode= '" & Text1 & "'"
Adodc1.Refresh
End If
If Option2 Then
Adodc1.RecordSource = "select medicinecode as 药品编码,medicinename as 药品名称,medkindcode as 药品类别代码,price as 售价,listprice as 厂价,stocknum as 库存量,unit as 单位,usefullife as 有效期至,ratifycode as 批准文号 from MedInfor where medicinename= '" & Text2 & "'"
Adodc1.Refresh
End If
If Option3 Then
Select Case Combo1.Text
Case "处方药"
Adodc1.RecordSource = "select medicinecode as 药品编码,medicinename as 药品名称,medkindcode as 药品类别代码,price as 售价,listprice as 厂价,stocknum as 库存量,unit as 单位,usefullife as 有效期至,ratifycode as 批准文号 from MedInfor where medkindcode= '1'"
Adodc1.Refresh
Case "非处方药"
Adodc1.RecordSource = "select medicinecode as 药品编码,medicinename as 药品名称,medkindcode as 药品类别代码,price as 售价,listprice as 厂价,stocknum as 库存量,unit as 单位,usefullife as 有效期至,ratifycode as 批准文号 from MedInfor where medkindcode= '2'"
Adodc1.Refresh
Case "中药饮片"
Adodc1.RecordSource = "select medicinecode as 药品编码,medicinename as 药品名称,medkindcode as 药品类别代码,price as 售价,listprice as 厂价,stocknum as 库存量,unit as 单位,usefullife as 有效期至,ratifycode as 批准文号 from MedInfor where medkindcode= '3'"
Adodc1.Refresh
Case "中药材"
Adodc1.RecordSource = "select medicinecode as 药品编码,medicinename as 药品名称,medkindcode as 药品类别代码,price as 售价,listprice as 厂价,stocknum as 库存量,unit as 单位,usefullife as 有效期至,ratifycode as 批准文号 from MedInfor where medkindcode= '4'"
Adodc1.Refresh
Case "医疗器械"
Adodc1.RecordSource = "select medicinecode as 药品编码,medicinename as 药品名称,medkindcode as 药品类别代码,price as 售价,listprice as 厂价,stocknum as 库存量,unit as 单位,usefullife as 有效期至,ratifycode as 批准文号 from MedInfor where medkindcode= '5'"
Adodc1.Refresh
Case "非药品(保健品)"
Adodc1.RecordSource = "select medicinecode as 药品编码,medicinename as 药品名称,medkindcode as 药品类别代码,price as 售价,listprice as 厂价,stocknum as 库存量,unit as 单位,usefullife as 有效期至,ratifycode as 批准文号 from MedInfor where medkindcode= '6'"
Adodc1.Refresh
End Select
End If
If Option4 Then
Adodc1.RecordSource = "select medicinecode as 药品编码,medicinename as 药品名称,medkindcode as 药品类别代码,price as 售价,listprice as 厂价,stocknum as 库存量,unit as 单位,usefullife as 有效期至,ratifycode as 批准文号 from MedInfor where usefullife <' " & Trim(Text13) & " ' "
Adodc1.Refresh
End If
If Adodc1.Recordset.EOF Then
MsgBox "无此信息!", , "提示"
Adodc1.RecordSource = "select medicinecode as 药品编码,medicinename as 药品名称,medkindcode as 药品类别代码,price as 售价,listprice as 厂价,stocknum as 库存量,unit as 单位,usefullife as 有效期至,ratifycode as 批准文号 from MedInfor "
Adodc1.Refresh
End If
End Sub
Private Sub Command7_Click()
Adodc1.Recordset.MovePrevious
If Adodc1.Recordset.BOF Then
Adodc1.RecordSource = "select medicinecode as 药品编码,medicinename as 药品名称,medkindcode as 药品类别代码,price as 售价,listprice as 厂价,stocknum as 库存量,unit as 单位,usefullife as 有效期至,ratifycode as 批准文号 from MedInfor "
Adodc1.Refresh
MsgBox "当前记录为第一条", , "提示"
End If
End Sub
Private Sub Command8_Click()
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF Then
Adodc1.RecordSource = "select medicinecode as 药品编码,medicinename as 药品名称,medkindcode as 药品类别代码,price as 售价,listprice as 厂价,stocknum as 库存量,unit as 单位,usefullife as 有效期至,ratifycode as 批准文号 from MedInfor "
Adodc1.Refresh
MsgBox "当前记录为最后一条", , "提示"
End If
End Sub
Private Sub Option1_Click()
Text1.SetFocus
Text2.Text = ""
Combo1.Enabled = False
Text13.Text = ""
End Sub
Private Sub Option2_Click()
Text2.SetFocus
Text1.Text = ""
Combo1.Enabled = False
Text13.Text = ""
End Sub
Private Sub Option3_Click()
Combo1.Enabled = True
Text1.Text = ""
Text2.Text = ""
Text13.Text = ""
End Sub
Private Sub Option4_Click()
Text4.SetFocus
Text1.Text = ""
Text2.Text = ""
Combo1.Enabled = False
Text13.Text = Date$
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -