View Full Version : Report Query Not Running


canadaboy
01-06-2004, 05:11 PM
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.

WayneRyan
01-06-2004, 05:14 PM
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

canadaboy
01-06-2004, 11:04 PM
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!!!

Rich
01-07-2004, 05:03 AM
DoMenuItem is obsolete now, use RunCommand acCmdSaveRecord instead