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

Lost focus event not firing before query unload

Status
Not open for further replies.

dlambert

Programmer
Apr 4, 2001
6
US
Hi all

My problem is that I have entered my validation code for my fields in the lost focus events of the controls on my forms. When a user clicks the close button on the form after having made a change to any control on the form the query unload event fires but the lost focus event does not.

This is a problem because the query unload event will allow them to make an update to my data source with the unvalidated data.

Any suggestions?
Thanks David
 
As for my design practice, I don't implement data validation on a lost focus event. I prefer to use it with the ADO recordset MoveComplete event. Then all the data validation takes place at the same time for the fields on the form. Now if you want to do field validation, try writing your validation code on the Validation event for that particular control.

Feel free to mark this post as helpful if it has aided you.
 
Thanks for your post Omega36

I tried moving my validation code to the validation event with the same result. The validation event does not fire before the query_unload event (I have no idea what MS is thinking here). To my mind when a user clicks the close button on the form he is essentially leaving the field that he may have just edited. Oh well.

Your first solution is not applicable as I am not using an ADO control to handle my recordset, instead I have implemented an ado object (per a microsoft technicians suggestion). Since I am not using a control I do not have access to the controls events.

Thanks for your suggestions
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top