Report Query Not Running

canadaboy

Registered User.
Local time
Today, 21:00
Joined
Sep 7, 2002
Messages
43
I have a report that is based on a query. When I open the report from a VBA module, the report does not show the current values in the query. Even when I switch the report into Design View and then back to Report view, the data stays the same (OLD).

If I manually run the query, close it, and then run the report again, the correct records will show up.

Is there a way to force the query to run before the report needs to access the data in the query? Is there another method that is more efficient, etc?

Please let me know.
 
Canada,

There must be some other issue here. The query is run when
the report opens and you don't have to do anything extra.

Could this be a case where the data on your form is not
committed to the table(s) yet? That could look like your
problem.

Does the query have Criteria based on some form?

Wayne
 
I thought that the report ran the query automatically, but it didn't look like it was doing it.

You were exactly right on that the underlying tables were not being updated. I don't know if it's considered good form or coding practice but I just put the following in my VBA code before opening the report that was based on the query:

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

This updated the tables and everything works fine. . .

Thanks!!!
 
DoMenuItem is obsolete now, use RunCommand acCmdSaveRecord instead
 

Users who are viewing this thread

Back
Top Bottom