Events in Access

  • Thread starter Thread starter Sean
  • Start date Start date
S

Sean

Is there a list some where that explains all of the events you can use on a
form and what they are for? Example, After Update, On Enter, Got Focus, Etc.
 
The Access help file does provide some info on this, but there are so many
events to look up that it's confusing to know where to start.

First thing to notice is that not only do the controls have events, but the
form has events in its properties as well. The form events are the ones to
learn first.

The BeforeUpdate event of the form is the most useful. Access fires that
just before the record gets saved, so it is the one to use to validate the
record. For example, if you want to warn the user if they leave the Surname
field blank, use Form_BeforeUpdate. You can't use any of the events of the
Surname text box, because the user may never click into that box, in which
case its events won't fire.

If BeforeUpdate is for validation, AfterUpdate is for responding to a
change. Form_AfterUpdate is for responding to changes in a record. For an
exmple of using the AfterUpdate event of a control, see:
Calculated Fields
at:
http://allenbrowne.com/casu-14.html

If you want to respond when a new record is added, use Form_AfterInsert.
Form_BeforeInsert fires when you start to add a new record, so it is useful
to stop the user adding a record (e.g. in a subform, when the main form is
at a new record.)

Form_Current fires each time a different record becomes current. Use this to
set things up for a record.

The Enter event of a control is useful for pulling tricks such as:
http://allenbrowne.com/TechniqueEnterCalcText.html

The LostFocus event of a control is useful for jumping to a different
control than the one that is next in the tab order.

There's heaps beyond that, but hopefully that gives you an idea where to
start.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top