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

MS Access Control Events

Status
Not open for further replies.

Viddy

IS-IT--Management
Sep 12, 2003
10
0
0
GB
I have a series of textboxes that require the same code to be executed when the user tabs out of them. In order to save filling my VBA script with eventhandlers for each text box, I have used a public sub that is called by each text box. I then use the Screen.Activecontrol to identify the actual control to apply the logic to.

Sounds great, but for some reason, the code is triggered three times! Can anyone explain this as I am lost.

I have tried other events on the controls and it happens with all of them. Also, If I code the [Event Handler] then it is only triggered once. The problem seems to be limited to calling a public sub from multiple controls.

Regards

Dave
 
Try this:

Change your sub to a function. Then shift select all of the appropriate text boxes and in the AfterUpdate Property or the LostFocus property (or whatever property your currently using) type =YourFunctionName()
 
That has sorted it.

Don't understand the logic of it, but as long as it works!

Thanks very much for your help.

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top