form elements and events

RobJen

Registered User.
Local time
Today, 23:15
Joined
Jul 19, 2005
Messages
35
Hi,

I have been looking for a way to do the following: say I have x ammount of fields/elements on a form and all need to do the same thing on a LostFocus event. I could do:

Code:
Private Sub element1_LostFocus()
do this
End Sub
Private Sub element2_LostFocus()
do this
End Sub
Private Sub element3_LostFocus()
do this
End Sub

But I would assume there is a easier way to do all this, can someone tell me what it is?

Thanks alot in advance.
 
I would use a function for the "Do This" code and call it from the LostFocus event from the controls property sheet.
A lot quicker to just paste the function call =DoThis() into the property sheet than keep opening the code window to reference it there.

HTH

Peter

HTH

Peter
 
ahh yes, i had already made a procedure, but i forgot i can call functions straight from access in the element properties window so =Function() at a LostFocus event works and keeps my vba clean...

Thanks a bunch!
 

Users who are viewing this thread

Back
Top Bottom