required fields on forms

  • Thread starter Thread starter DJ Finnegan
  • Start date Start date
D

DJ Finnegan

I have a form that has a yes/no check box for cetain fields. If this box is
yes I want certain other fields required input. Is this possible?
Any help would be appreciated, this is getting way over my head.
 
I have a form that has a yes/no check box for cetain fields. If this box is
yes I want certain other fields required input. Is this possible?
Any help would be appreciated, this is getting way over my head.

You can do this kind of checking in the Form's BeforeUpdate event. Click the
.... icon by that event property and choose Code Builder; edit the code to
something like

Private Sub Form_BeforeUpdate(Cancel as Integer)
If Me!checkboxcontrol Then
If Me!txtThis & "" = "" Then
MsgBox "If <checkbox> is checked you must fill in <textbox>", vbOKOnly
Me!txtThis.SetFocus
End If
End If
End Sub
 
THANKS!!!!

John W. Vinson said:
You can do this kind of checking in the Form's BeforeUpdate event. Click the
.... icon by that event property and choose Code Builder; edit the code to
something like

Private Sub Form_BeforeUpdate(Cancel as Integer)
If Me!checkboxcontrol Then
If Me!txtThis & "" = "" Then
MsgBox "If <checkbox> is checked you must fill in <textbox>", vbOKOnly
Me!txtThis.SetFocus
End If
End If
End Sub
 
Back
Top