开发者

Table updating - but report is empty. Reopening report shows correct data

开发者 https://www.devze.com 2023-04-11 07:33 出处:网络
Should be an easy one for the experienced? I collect data from multiple other tables and do calculations in VBA with which I add rows with DoCmd.RunSQL to a printout table. (Before this, I delete pre

Should be an easy one for the experienced?

I collect data from multiple other tables and do calculations in VBA with which I add rows with DoCmd.RunSQL to a printout table. (Before this, I delete previous printout rows.)

After this I do a db.Close + Set db=Nothing, then display a dialog whether to preview or print. Upon selecting Preview, the report is shown, but it's empty. (As in, all the labels are there, there are 0 rows of data, and all the other data fields are blank.)

The report associates printout rows with the current user, so it's valid to "ju开发者_开发百科st open" the report, and then it shows the correct data.

If I keep the table open while running, I can see the DELETE FROM taking effect ('##Deleted##' or something similar), but I can't see INSERT INTOs taking effect until I re-open the table.

I use no connection, I use Dim db as dao.Database + Set db=CurrentDB; data is written to a local (non-linked) table; there's nothing special in the query (sort of, SELECT field1,field2... FROM mytbl WHERE user=currentuser) the report is based on; there's no code module for the report.

What's going on here, and how do I fix it?


Boy, am I feeling stupid now. I copied the DoCmd.OpenReport line from an identical report that used another table as data. The problem is, when I changed it to have an OpenArg, I had too few commas and it unnoticably ended up being a "filter". Code hinting is there for a reason... oh well :)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号