Solved

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

Posted on 2013-10-22
4
379 Views
Last Modified: 2013-10-26
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
Comment
Question by:SteveL13
  • 2
4 Comments
 
LVL 57

Expert Comment

by:Jim Dettman (Microsoft MVP/ EE MVE)
Comment Utility
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
 

Author Comment

by:SteveL13
Comment Utility
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
 
LVL 57

Expert Comment

by:Jim Dettman (Microsoft MVP/ EE MVE)
Comment Utility
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
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 total points
Comment Utility
Also, make sure you are using the AfterUpdate event of the *Form*,
(...not the after update event of the control....)
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

771 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

13 Experts available now in Live!

Get 1:1 Help Now