Solved

Change Versus AfterUpdate

Posted on 2007-12-03
6
1,491 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

813 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

12 Experts available now in Live!

Get 1:1 Help Now