Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OnChange event versus AfterUpdate event?

Status
Not open for further replies.

KerryL

Technical User
May 7, 2001
545
US
How does the OnChange event differ from the AfterUpdate event?

For example:
On one of my forms I would like the cboStatus field to change from "Open" to "Closed" when a date is entered into the txtDateCompleted field.

Normally when I want one field to be modified after another one is updated I use the AfterUpdate event. But I was wondering if the OnChange event would work better in some cases, and if so, which ones.

Not a major issue, just wondering.

KerryL
 
Kerryl,

I think your best bet is just to try them.


Rollie E
 
After Update is called once as focus is shifting away from the control while Change is called every time something happens (eg 5 times while you type Hello).

Good question! Good Luck! Please remember to give helpful posts the stars they deserve! This makes the post more visible to others in need![thumbsup]
 
First off cboStatus and txtDateCompleted are CONTROLS not fields.

As controls they may well be Bound to fields in the underlying table - but THEY are not fields themselves.


OnChange fires as soon as the user types the first character into the control.

AfterUpdate occures after the focus leaves the control, and only then if the data in the control has been changed by the user.

In your case you can use code in the txtDateCompleted control's BeforeUpdate to verify that the data is appropriate
Then code in the control's AfterUpdate to set the cboStatus control


'ope-that-'elps


G LS
accessaceNOJUNK@valleyalley.co.uk
Remove the NOJUNK to use.

Please remember to give helpful posts the stars they deserve!
This makes the post more visible to others in need! :-D

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top