Question How to run On Enter Event only once

gnarpeggio

Registered User.
Local time
Today, 15:07
Joined
Jun 22, 2010
Messages
74
Hello,

I'm trying to add a MsgBox to the On Enter event of my control, but is there a way to set it to run only once? Or does this always occur when entering the control?

Thanks!

Matt
 
The enter event will occur every time the user enters the control. If you only want it to happen once, you could create a form-level variable, and test it in the enter event. When you fire the message box, change the value of the variable.
 
I understand the process, but can you provide an example of how this might work? I'm terrible with VBA at the moment.

Thanks again!
 
You could use a static variable inside the Enter event as well.

Static blnFlag As Boolean

and then

If Not blnFlag Then

then do your stuff and at the end

blnFlag = True

and then it will stay like that until Access is closed and re-run.
 

Users who are viewing this thread

Back
Top Bottom