CheckBox Selection Only after Text Box Entry

gyli84

Registered User.
Local time
Today, 07:41
Joined
Aug 8, 2001
Messages
25
I have a form with a checkbox. I only want the user to be able to select the check box and change the status to "yes" after text has been typed in a text box (say this text box is called textbox1 and the check box is called checkbox1). I would be grateful if anyone had an idea as to how this can be done. Thanks.
 
Use the before update event of the check box to check for null entries in your text box something like If IsNull(Me.txtboxName) Then
MsgBox "Whatever"
txtboxName.SetFocus
EndIf
HTH
 
What is the "Me." section of the code? When I try to click the checkbox it now says it cannot find the macro "If IsNull(Me." Also, what does "TxtBoxName.SetFocus" do?

THanks
 
Click on your checkbox in design view and go to properties. Click the event tab, and where it says "On BeforeUpdate" choose "[Event Procedure]", and click the build button (that thing with the three dots). When the code window opens, put in the following five lines ofcode exactly as they appear.

If IsNull(me.textbox1) Then
MsgBox "Cannot change this value when field is blank"
textbox1.setfocus
Cancel = -1
End If


"Me." refers to whichever form you happen to have open.

txtbox.setfocus moves the cursor into the field of that name.

If you have any more trouble, let us know

Keagan Quilty
Kilbride, Newfoundland
 

Users who are viewing this thread

Back
Top Bottom