有人能帮助我吗?如果库存量小于15,如何在列表框中显示药品?
我尝试了这段代码,但它没有用。
Private Sub List1_Click()
If Text3.Text <= 15 And Text3.Text > 1 Then List1.AddItem Adodc1.Recordset("MedicineName")
end sub
似乎我的代码错了。我不知道接下来该做什么。请帮忙
以下是 datagrid 中的代码:
Private Sub DataGrid2_Click()
With frm_ScrollUP1
.Text3.Text = Adodc2.Recordset.Fields("StockQuantity")
.Combo1.Text = Adodc2.Recordset.Fields("medicinename")
If Text3.Text < 0 Then
MsgBox Combo1 & " stock is not enough for the quantity you need!", vbExclamation, " SORRY..."
Text3.Text = ""
Exit Sub
End If
If Text3.Text <= 15 And Text3.Text > 1 Then
MsgBox "Please add more stocks of " & Combo1 & " !", vbExclamation, " Warning!"
ElseIf Text3.Text = 0 Then
MsgBox Combo1 & " is Empty!", vbCritical, " Warning!"
End If
Combo1 = "Medicine Brand"
Text2.Text = ""
Text3.Text = ""
Combo2 = "---MMMM----"
Combo3 = "-DD-"
Combo4 = "---YYYY---"
Text2.Enabled = False
End With
end sub
答案 0 :(得分:0)
将Text
与数字进行比较时,最好将字符串转换为数字:
If Val(Text3.Text) <= 15 And Val(Text3.Text) > 1 Then List1.AddItem Adodc1.Recordset("MedicineName")