[AccessD] Force Query to recalc using code.

Steve Schapel steve at datamanagementsolutions.biz
Mon Aug 30 22:10:00 CDT 2010


Darryl,

Assuming you are talking here about Select queries, then they don't need to 
be run/updated/refreshed in order to return the current data.  (Unless I am 
misunderstanding you.)

I think you are probably onto the answer where you mention the saving of the 
edited records on the form.  You might need to do:
    DoCmd.RunCommand acCmdSaveRecord
or:
    Me.Dirty = False

prior to the code that refers to the query.

Regards
Steve

-----Original Message----- 
From: Darryl Collins
Sent: Tuesday, August 31, 2010 2:49 PM
To: Access Developers discussion and problem solving
Subject: [AccessD] Force Query to recalc using code.


Hi Everyone,

I am updating a MS Access database that was largely built by someone else. 
In this database there are lots of pre-built queries, sorted as queries.  I 
seems that a process is failing as I need to force the query to update 
before the code does something with it.

I though I would use query def for this, but I cannot seem to figure out the 
syntax.  Normally I would just call the data I want from a RS using Code, 
which is always based on the latest data.  This query business seems to be a 
bit flakey in places.  Actually it is probably more the way the data is 
being updated into a bound form, the recordsaved and then the query run that 
is the issue.

Anyway.  What I would like is something like "qryMyQuery.Refresh" in the 
code to force it to update.  Advice with this is appreciated.

cheers
Darryl.




More information about the AccessD mailing list