Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Required Data on a form

Status
Not open for further replies.

jpmillr1

Technical User
Jun 13, 2003
12
0
0
US
Is there a way to require a text box to have some data entered on a form? I have set the "Required" property to YES and the "AllowZeroLength" property to NO already, but I am still able to skip those fields in the form.

How can I demand that a user enter something into this data field on a form?

Thanks,
John
 
Try this...

In the On Close property of the form (or the place where you leave the current record i.e. Add New Record Button) include some code like this:

If IsNull(me.NameofYourfield) Then
msgbox("You must enter a value in this field before proceeding.")
me.NameofYourField.SetFocus
Endif

You could also try putting this code in the On Lost Focus property of the field you are requiring.

hope this helps you.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top