Morning all,
My scenario: I'm building a form that has 3 fields, and 2 tick boxes. The tick boxes will change depending on the value of the fields. Brief description:
Field A is a current stock # of printer cartridges.
Field B is the number I wish to book in or out of the system.
Field C is the minimum # of cartridges we need to have in stock.
Tick Box 1 is a notification that the minimum stock level has been breached, but has not yet reached zero.
Tick Box 2 is a notification that the stock level has reached zero.
Here is my code for the command button used to book cartridges INTO the the database.
-----------------------------------------------------------
Private Sub Command2_Click()
Dim instock, bookedin As Single
Dim instock_field As String
Dim bookedin_field As String
instock = Me!instock_field
bookedin = Me!bookedin_field
If Not IsNull(bookedin_field) Then
instock = instock + bookedin
End If
If (instock) < (minnumber) Then
MsgBox "Please be aware there is still less than the minimum # of cartridges in stock. Consider purchasing more.", _
vbOKOnly + vbExclamation, _
"Cartridge Stock Alert - Warning"
Me!chkReorder_box = True
Else
Me!chkReorder_box = False
End If
If (instock) = 0 Then
Me!chkOutOfStock = True
Else
Me!chkOutOfStock = False
End If
Me!instock_field = instock
End Sub
-----------------------------------------------------------
This code is identical for booking cartridges OUT of the system.
The problem: The error messages and the tick boxes respond perfectly for the BOOK OUT command button, but they refuse to for the BOOK IN command button. Instead, both tick boxes simply return to False, even if the # in stock is less than the minimum required.
Now while this isn't a problem if I'm booking in enough cartridges so that instock is higher than the min # needed, it's bugging me and I want to fix it.
If any of you can help, it'd be great
My scenario: I'm building a form that has 3 fields, and 2 tick boxes. The tick boxes will change depending on the value of the fields. Brief description:
Field A is a current stock # of printer cartridges.
Field B is the number I wish to book in or out of the system.
Field C is the minimum # of cartridges we need to have in stock.
Tick Box 1 is a notification that the minimum stock level has been breached, but has not yet reached zero.
Tick Box 2 is a notification that the stock level has reached zero.
Here is my code for the command button used to book cartridges INTO the the database.
-----------------------------------------------------------
Private Sub Command2_Click()
Dim instock, bookedin As Single
Dim instock_field As String
Dim bookedin_field As String
instock = Me!instock_field
bookedin = Me!bookedin_field
If Not IsNull(bookedin_field) Then
instock = instock + bookedin
End If
If (instock) < (minnumber) Then
MsgBox "Please be aware there is still less than the minimum # of cartridges in stock. Consider purchasing more.", _
vbOKOnly + vbExclamation, _
"Cartridge Stock Alert - Warning"
Me!chkReorder_box = True
Else
Me!chkReorder_box = False
End If
If (instock) = 0 Then
Me!chkOutOfStock = True
Else
Me!chkOutOfStock = False
End If
Me!instock_field = instock
End Sub
-----------------------------------------------------------
This code is identical for booking cartridges OUT of the system.
The problem: The error messages and the tick boxes respond perfectly for the BOOK OUT command button, but they refuse to for the BOOK IN command button. Instead, both tick boxes simply return to False, even if the # in stock is less than the minimum required.
Now while this isn't a problem if I'm booking in enough cartridges so that instock is higher than the min # needed, it's bugging me and I want to fix it.
If any of you can help, it'd be great