S
Slej
SITUATION
I have an Orders Form with two command buttons: Pull Sheet & Packing Slip.
The form also has fields for the user to enter Order Date, Entered Date, and
Picked Date.
What I would like to do is, if all three date fields have dates in them,
then both command buttons are active; if certain combinations of the fields
are completed or not, then either one, both, or neither button is selectable.
I put the code below in the ON CURRENT for the form. This works well BUT,
it doesn't take effect until the user exists the current record then goes
back to it. For example, if a new order comes in and the Order Date and the
Entered Date are completed, the Pull Sheet button isn't selectable until that
record is left and then returned to.
Private Sub Form_Current()
If (Me.receivedate) >= #1/1/1900# And (Me.enterdate) >= #1/1/1900#
And (Me.pickdate) >= #1/1/1900# Then
Me.btnPullSheet.Enabled = True
Me.btnPackingSlip.Enabled = True
ElseIf (Me.receivedate) >= #1/1/1900# And (Me.enterdate) >=
#1/1/1900# Then
Me.btnPullSheet.Enabled = True
Me.btnPackingSlip.Enabled = False
Else
Me.btnPullSheet.Enabled = False
Me.btnPackingSlip.Enabled = False
End If
End Sub
QUESTION
Is there a way to code the form or the buttons or the date controls so that
the command buttons will immediately either become active or disabled without
having to exit the record? Thanks.
I have an Orders Form with two command buttons: Pull Sheet & Packing Slip.
The form also has fields for the user to enter Order Date, Entered Date, and
Picked Date.
What I would like to do is, if all three date fields have dates in them,
then both command buttons are active; if certain combinations of the fields
are completed or not, then either one, both, or neither button is selectable.
I put the code below in the ON CURRENT for the form. This works well BUT,
it doesn't take effect until the user exists the current record then goes
back to it. For example, if a new order comes in and the Order Date and the
Entered Date are completed, the Pull Sheet button isn't selectable until that
record is left and then returned to.
Private Sub Form_Current()
If (Me.receivedate) >= #1/1/1900# And (Me.enterdate) >= #1/1/1900#
And (Me.pickdate) >= #1/1/1900# Then
Me.btnPullSheet.Enabled = True
Me.btnPackingSlip.Enabled = True
ElseIf (Me.receivedate) >= #1/1/1900# And (Me.enterdate) >=
#1/1/1900# Then
Me.btnPullSheet.Enabled = True
Me.btnPackingSlip.Enabled = False
Else
Me.btnPullSheet.Enabled = False
Me.btnPackingSlip.Enabled = False
End If
End Sub
QUESTION
Is there a way to code the form or the buttons or the date controls so that
the command buttons will immediately either become active or disabled without
having to exit the record? Thanks.