A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Update vs Change



 
 
Thread Tools Display Modes
  #1  
Old January 24th, 2009, 06:29 PM posted to microsoft.public.access.forms
Steve S
external usenet poster
 
Posts: 162
Default Update vs Change

What is the difference (other than the spelling) between the ..Update event
and the Change event for a text box and/or a combo box.
--
Steve S
  #2  
Old January 24th, 2009, 06:46 PM posted to microsoft.public.access.forms
Rick Brandt
external usenet poster
 
Posts: 4,354
Default Update vs Change

On Sat, 24 Jan 2009 10:29:01 -0800, Steve S wrote:

What is the difference (other than the spelling) between the ..Update
event and the Change event for a text box and/or a combo box.


Update is when you are finished, usually when you tab out of the
control. Change is per key-stroke.

Before Update is usually used to react to what the user entered and
possibly dissallow it (validation). AfterUpdate is used to respond to
what the user entered without the ability to cancel it.

Change is the least used of the three generally.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
  #3  
Old January 25th, 2009, 01:00 AM posted to microsoft.public.access.forms
Albert D. Kallal
external usenet poster
 
Posts: 2,874
Default Update vs Change

"Steve S" wrote in message
...
What is the difference (other than the spelling) between the ..Update
event
and the Change event for a text box and/or a combo box.
--
Steve S


You've got a good answer from Rick....

I even expand on this more.

The change event fires for every single key press you use, and furthermore
to detect what the value of the text box is, you actually have to use

me.NameOfTextBox.Text

notice and above how I've used the text property of that control on the
form, normally in almost all cases we use:

me.NameOfTextBox.Value
or
me.NameOfTextBox (the default property of the text box is value, so
we often or for the most part leave it out)

So when you use the chang event of a control, the contents of that text box
have not been updated, and the value property has not yet been updated.
(commited) In fact this is about the only time that we used the text
property of a control on a form, otherwise it's not much use and ".text" is
only legal when the contorl has focus.

As a general rule you'll not use the change event of a contorl very often,
perhaps for key press processing or some action that to occur while you're
editing a text box. In other words each change by typing/editing/etc. that
modify the contents of that box, the change event fires each time that
occurs.

The before update, or after update events do not fire until you are done
editing that controll and then are attempting to move out of the control.
Furthermore it's important to note that these events do not fire if a user
does NOT change the contents of the text box (or if the user stars and
adding a text box and realizes are on the wrong text box, and then the
edit-undo, the after update events will not fire -- however during an
editing and change process the change event will be firing.

In general when you're using a list box or combo box, you'll still use the
after update event to do something on the form in response to a user having
changed or selected a value in the combo or list box.

i


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:51 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.