Limit Entry in Field

  • Thread starter Thread starter Thorson
  • Start date Start date
T

Thorson

I have a form that has multiple fields for the user to enter information in.
One field, txtOffLabelWithdrawalDt I would like to be greyed out or not allow
the user to enter in any information unless the check box field
txtOffLabelUse is checked.

How do I do this?
Thank you.
 
Thorson said:
I have a form that has multiple fields for the user to enter information
in.
One field, txtOffLabelWithdrawalDt I would like to be greyed out or not
allow
the user to enter in any information unless the check box field
txtOffLabelUse is checked.

How do I do this?


You need a little code to enable or disable the text box in two events, the
form's Current event and the AfterUpdate event of the txtOffLabelUse. By
the way, is the name of that control really "txtOffLabelUse"? Usually the
"txt" prefix is used for text boxed, and "chk" is used for check boxes.

Anyway, the code would look something like this:

'----- start of example code -----
Private Sub Form_Current()

Me.txtOffLabelWithdrawalDt.Enabled = (Me.txtOffLabelUse)

End Sub

Private Sub txtOffLabelUse_AfterUpdate()

Me.txtOffLabelWithdrawalDt.Enabled = (Me.txtOffLabelUse)

End Sub
'----- end of example code -----
 
It works perfectly! Thank you!
The name was txtOffLabelUse, I wasn't sure what else to call it, I changed
it to chkOffLabelUse (and changed my code accordingly).

Thank you for the help!
 
Back
Top