• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 446
  • Last Modified:

How make query run ONLY if data on a form has been changed

What event do I use to run a query ONLY of data on a form has changed?  I thought it would be afterupdate but even if I haven't changed anything on the current form's data the query seems to want to run.
0
SteveL13
Asked:
SteveL13
  • 2
1 Solution
 
Jim Dettman (Microsoft MVP/ EE MVE)PresidentCommented:
AfterUpdate is it.   It only fires if the record was updated.

Note that if you change a control, then change it back, it's still considered a change.

Jim.
0
 
SteveL13Author Commented:
Hmmm.  I have it in the afterupdate event of the form but the query is trying to run even if I haven't changed any data in the current record.
0
 
Jim Dettman (Microsoft MVP/ EE MVE)PresidentCommented:
Something your doing must be making the record dirty.

Turn the record selectors on and then watch when it changes to a pencil.  That's the point the record is considered changed.

Another check:

1. Call the record up.
2. Hit esc twice (undo control and undo form).
3. Now close the form.  You should find that your query does not run.

Jim.
0
 
Jeffrey CoachmanMIS LiasonCommented:
Also, make sure you are using the AfterUpdate event of the *Form*,
(...not the after update event of the control....)
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now