L
lisa09
Guest
Hi,
Sorry I have another problem!
I am trying to create a simple database that records customer orders and checks stock levels.
I would like for when a user enters the quantity required for a particular product on my orders form, for a query to be run to see if the quantity (input) is greater than the quantityinstock field (tblproducts).
Currently I have added the following code to the quantity field on my orders form on the after update event:
Private Sub Quantity_AfterUpdate()
If QuantityinStock.Value < Quantity.Value Then
MsgBox "There is currently not enough stock to meet the quantity required. There is" & QuantityinStock & "available", vbInformation, "Stock"
Else
MsgBox "Product In Stock", vbInformation, "Stock"
End If
End Sub
It seems to be working ok, although on certain occasions i.e. when an order is modified it doesnt work correctly and displays the wrong message box i.e stock is available when it is not.
I do not know much about access or coding and was wondering if you could see anything wrong with the code.
Many thanks
Sorry I have another problem!
I am trying to create a simple database that records customer orders and checks stock levels.
I would like for when a user enters the quantity required for a particular product on my orders form, for a query to be run to see if the quantity (input) is greater than the quantityinstock field (tblproducts).
Currently I have added the following code to the quantity field on my orders form on the after update event:
Private Sub Quantity_AfterUpdate()
If QuantityinStock.Value < Quantity.Value Then
MsgBox "There is currently not enough stock to meet the quantity required. There is" & QuantityinStock & "available", vbInformation, "Stock"
Else
MsgBox "Product In Stock", vbInformation, "Stock"
End If
End Sub
It seems to be working ok, although on certain occasions i.e. when an order is modified it doesnt work correctly and displays the wrong message box i.e stock is available when it is not.
I do not know much about access or coding and was wondering if you could see anything wrong with the code.
Many thanks