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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

best way to validate user input?

Status
Not open for further replies.

Gerilee

Programmer
Mar 23, 2001
47
US
Forgive me if this question is a repeat. I have spent the last several hours searching FAQ's and posts but still have some questions. I am learning Access and VBA. I have a form with bound controls for user input. I am using VBA to do validation and want to return an error message to the user as soon as the error is made. In some cases, changing fld1 makes fld2 invalid and vice versa. In other cases, the value of a field makes another visible. I am confused as to where to place the VBA validation routines. I have experimented with using the Before_Update, After_Update, and Exit events for the control and the form. It seems that I need to use one or the other for these different scenarios. Is it better to use the Form event or the Control event? And am I even using the right events? I'm not having a lot of problem with the code because of my COBOL background -- it's just I'm not sure of the best way to execute it from the form. Any help will be greatly appreciated.
 
IMHO, the most important is the BeforeUpdate event of the Form where you check and validate ALL controls before they become fields.
You may also play with the BeforeUpdate and Exit events of the Controls for a more responsive GUI.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV,

Thanks so much for your reply. Sorry it took me so long to get back -- I was moving code and experimenting using your suggestion. Great advice. Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top