How do you stop the event order? (1 Viewer)

chuckcoleman

Registered User.
Local time
Today, 11:58
Joined
Aug 20, 2010
Messages
363
I have a Combo Box that its "Limit to List" is Yes. If the user attempts to enter something that isn't in the list, I produce a MsgBox that tells them that. For that same Combo Box there is an "On Change" event that runs a big macro. When I look at the Event Order, it is: KeyDown, KeyPress, Change, KeyUp, Not-In-List, Error. Since the Not-In-List occurs after the Change, the macro runs but since the Combo Box has a value that is not in the list, I get a Macro Single Step dialog box and the user has to click on "Stop All Macros".

How can I prevent the macro in the On Change event from running if the user types something in the Combo Box that isn't in the list?

Thanks,

Chuck
 

theDBguy

I’m here to help
Staff member
Local time
Today, 09:58
Joined
Oct 29, 2018
Messages
21,454
Hi Chuck. What is the purpose of the OnChange event? Were you aware it fires every time the user types a character into the combobox? If you don't need the macro to run for each character entered, then maybe you can move the macro to the AfterUpdate event instead. Just a thought...
 

Dreamweaver

Well-known member
Local time
Today, 17:58
Joined
Nov 28, 2005
Messages
2,466
I have a function for adding Items to combo boxes I really wouldn't use macros but thats me.

There is a complete description of how to add it t your project
 

chuckcoleman

Registered User.
Local time
Today, 11:58
Joined
Aug 20, 2010
Messages
363
Hi Chuck. What is the purpose of the OnChange event? Were you aware it fires every time the user types a character into the combobox? If you don't need the macro to run for each character entered, then maybe you can move the macro to the AfterUpdate event instead. Just a thought...
Good Morning DBG. Always great to hear from you. I moved the event to the AfterUpdate event and that improved the situation. I have my own MsgBox message, but I still get the Access message, "The text you entered isn't an item in the list." What's your suggestion on preventing that?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 09:58
Joined
Oct 29, 2018
Messages
21,454
Good Morning DBG. Always great to hear from you. I moved the event to the AfterUpdate event and that improved the situation. I have my own MsgBox message, but I still get the Access message, "The text you entered isn't an item in the list." What's your suggestion on preventing that?
That would depend on your NotInList code. Are you using the Response argument? If not, try using it.
 

chuckcoleman

Registered User.
Local time
Today, 11:58
Joined
Aug 20, 2010
Messages
363
I have a function for adding Items to combo boxes I really wouldn't use macros but thats me.

There is a complete description of how to add it t your project
Thank you MickJav. I've really moved away from macro's and I really like vba. I understand your point. I can convert/re-write the macro into vba but it's a really long macro. I'll look at your description. Thanks.
 

Dreamweaver

Well-known member
Local time
Today, 17:58
Joined
Nov 28, 2005
Messages
2,466
I might put it into a db as It would be simpler for member to start using it.
 

Users who are viewing this thread

Top Bottom