0
有人可以幫助我嗎?如果庫存數量少於15,如何在列表框中顯示藥品?列表框添加項目
我試過這段代碼,但它不工作。
Private Sub List1_Click()
If Text3.Text <= 15 And Text3.Text > 1 Then List1.AddItem Adodc1.Recordset("MedicineName")
end sub
似乎我的代碼是錯的。我不知道下一步該怎麼做。請幫助
這是我在數據網格代碼:用數字對比Text
時
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
只是爲了澄清你說在列表框中顯示項目,如果它小於15但您的代碼小於或等於* 15。您是否嘗試單步執行代碼? – vbguyny