Solved

Change Versus AfterUpdate

Posted on 2007-12-03
6
1,387 Views
Last Modified: 2010-05-18
I have a very simple question...When i double click on a textbox or combobox while in design mode in VBE it adds a sub procedure like Sub Textbox1_Change()....It never adds Sub Textbox1_afterupdate....I have used both and can't tell the difference....What is the difference between these two and is one better than the other?
0
Comment
Question by:ToddHawley4984
6 Comments
 
LVL 65

Expert Comment

by:Jim Horn
ID: 20397544
>What is the difference between these two and is one better than the other?
In my experience the only time Change is used is with tab controls, when a user clicks on a tab it fires the tab control Change event.  Otherwise, use AfterUpdate.
0
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 50 total points
ID: 20397576
Neither is intrinsically better than the other--it's a matter of what you need to, and picking the
right event to handle it.

For textboxes...
The Change event fires as soon as you start typing in the textbox.  AfterUpdate does not
fire until after you tab off of the control, basically.  So, if I want to enter "foo" into a text box,
the Change event would fire three times, and AfterUpdate just once.  There is also a
BeforeUpdate event that I find extremely useful if I need to validate entries.
0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 20397592
Jim,

I'll use the Change event with list-only comboboxes.  I stay away from the Change event in
textboxes for the reason stated above :)

Regards,

Patrick
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 65

Expert Comment

by:Jim Horn
ID: 20397614
{a qualification on my earlier comment }
Most of that is from Access VBA experience.  Excel VBA or VB may differ, and if so matthewspatrick would know it.
0
 
LVL 9

Expert Comment

by:antontolentino
ID: 20398679
change event is useful if you want to simulate the auto complete suggestion list
0
 

Author Closing Comment

by:ToddHawley4984
ID: 31412398
Great thats what i was missing Thank you
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now