Require a field to be fill if yes in another field

M

martha.dempsey

I have a field called NotaryYN which serves as the source
for an option group using Yes or No. I need the user to
complete text box NotaryExp if the answer is Yes.

Any suggestions?

Thanks
martha
 
D

david

This requires a multi-part answer, but it is fairly
simple.

First, set up your option group On_Click so that

If Me.NotaryYN = yes Then
Me.NotaryExp.SetFocus
End If

Next for your text box you need to set up another piece
for its On_Exit Event so that

If IsNull(Me.NotaryExp) Then
--it is nice to include a Message Box at this point--
MsgBox "This field must contain data to continue!",
vbOKOnly
Me.Field.SetFocus - this can be any field other than
NotaryExp
Me.NotaryExp.SetFocus
End If

This will prevent the end user from leaving the field
NotaryExp without data. However, from personal
experience, nothing stops them from typing in garbage
data. I've set this up on several databases, and find
the field sometimes contains "N/A" or just some random
letter or number...whatever is required to get them past
that box. And you can try applying If Then Statements to
deny them that option, but they still find a combination
of junk to throw in their. Just look at it as job
security for a database administrator! :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top