PDA

View Full Version : How to make a text box mandatory?



hypuk
10-14-2009, 11:43 PM
Hi guys

How do I make a text box mandatory, so if the user clicks or tabs on to the next field it fires a error message?

Any help would be much appreciated

Thanks
Mark

Bob Phillips
10-15-2009, 12:24 AM
Look at the Exit method of the TextBox.

hypuk
10-15-2009, 01:22 AM
Hi there

I'm new to VBA so I don't understand what you're talking about

Thanks
Mark

Bob Phillips
10-15-2009, 02:20 AM
Do you know how to create a userform and assign events to controls?

hypuk
10-15-2009, 03:47 AM
Hi There

I've found out how to do it now

Thanks
Mark

JP2112
10-15-2009, 10:15 AM
This might not be the answer you're looking for, but it's better to check for missing fields at the end of the data entry process, instead of interrupting the user every time they skip a field. Not every user fills out the same form the same way.

For example, the code behind a Submit button that writes fields in your form to a database could check if all required fields are filled, and pop up a message box at that time.