📄 frm_standard_query.frm
字号:
VERSION 5.00
Begin VB.Form Frm_Standard_Query
BorderStyle = 1 'Fixed Single
Caption = "药品信息查询"
ClientHeight = 2040
ClientLeft = 4635
ClientTop = 3150
ClientWidth = 3360
Icon = "Frm_Standard_Query.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2040
ScaleWidth = 3360
StartUpPosition = 2 '屏幕中心
Begin VB.ComboBox Combo2
Height = 300
Left = 1140
Style = 2 'Dropdown List
TabIndex = 6
Top = 780
Visible = 0 'False
Width = 1995
End
Begin VB.ComboBox Combo1
Height = 300
Left = 1140
Style = 2 'Dropdown List
TabIndex = 3
Top = 240
Width = 1995
End
Begin VB.TextBox Text1
Height = 300
Left = 1140
TabIndex = 2
Top = 780
Width = 1995
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 300
TabIndex = 1
Top = 1440
Width = 975
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 1920
TabIndex = 0
Top = 1440
Width = 975
End
Begin VB.Label Label1
Caption = " 查询条件"
Height = 195
Left = 120
TabIndex = 5
Top = 300
Width = 915
End
Begin VB.Label Label2
Caption = "查询内容"
Height = 255
Left = 240
TabIndex = 4
Top = 840
Width = 855
End
End
Attribute VB_Name = "Frm_Standard_Query"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Combo1_Click()
If Combo1 = "供应商" Then
Text1.Visible = False
Combo2.Visible = True
Else
Text1.Visible = True
Combo2.Visible = False
End If
Text1 = Combo1
End Sub
Private Sub Combo2_Click()
' Text1 = Combo2
End Sub
Private Sub Combo2_LostFocus()
Text1 = Combo2
End Sub
Private Sub Command1_Click()
On Error GoTo myerr
Dim cn As ADODB.Connection
Dim rst As New ADODB.Recordset
Dim lt As ListItem
Frm_Standard.ListView1.ListItems.Clear
Set cn = GetCn
Select Case Combo1
Case "名称"
Combo1.Tag = "a.name"
Case "药种"
Combo1.Tag = "a.model"
Case "供应商"
Combo1.Tag = "b.short_name"
End Select
rst.Open "select a.name,b.short_name,a.model,a.normal,a.packing,a.unit,a.in_price,a.out_price,a.part_id from standard a inner join supply b on a.supply_id=b.supply_id where a.stop=0 and " & Combo1.Tag & " like '%" & Trim(Text1) & "%' order by 1", cn, 0, 1
If rst.BOF And rst.EOF Then Exit Sub
Do While Not rst.EOF
Set lt = Frm_Standard.ListView1.ListItems.Add(, , rst(0), 8, 8)
For I = 1 To rst.Fields.Count - 1
lt.SubItems(I) = Trim(rst(I) & "")
Next I
rst.MoveNext
Loop
rst.Close
cn.Close
Unload Me
Exit Sub
myerr:
Select Case Err
Case -2147217904
If rst.State = 1 Then rst.Close
rst.Open "select count(*) from standard", cn, 0, 1
If rst(0) = 0 Then
Exit Sub
Else
MsgBox Error, vbExclamation, "提示"
End If
Case Else
MsgBox Error, vbExclamation, "提示"
End Select
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Combo1.Clear
Combo1.AddItem "名称"
Combo1.AddItem "药种"
Combo1.AddItem "供应商"
Combo1.ListIndex = 0
Dim cn As ADODB.Connection
Dim rst As New ADODB.Recordset
Set cn = GetCn
rst.Open "select short_name from supply ", cn, 0, 1
If rst.BOF And rst.EOF Then
MsgBox "请先维护供应商信息!", vbExclamation, "提示"
Command1.Enabled = False
rst.Close
cn.Close
End If
Do While Not rst.EOF
Combo2.AddItem rst(0)
rst.MoveNext
Loop
rst.Close
cn.Close
Combo2.ListIndex = 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -