Sorry, I inadvertently posted this reply back to the individual. (just
delete
it from your e-mail Access) Here is my reply on the newsgroup:
Thanks muchly. That worked great.
There is small glitch that is happening though on this line of code.
When I open the report, my code module runs without a hitch and the last
line 'me.requery' retrieves the records as I wanted. When I click 'Print
Preview', it looks like my code runs again (?) and generates an error
message "Run time error '2467': The expression you entered refers to an
object that is closed or doesn't exist." When I click debug, its stalled on
the 'me.requery' line. When I clear the error box, the report goes on into
print preview just fine so ultimately there doesn't seem to be any real
problem. It's rather annoying though and I don't see why my code module is
running again when all I've done is click on print preview for the report?
Any ideas/suggestions?
Thanks,
Gord
"Access" <al*********@gmail.comwrote in message
news:70**********************************@l42g2000 hsc.googlegroups.com...
On Jul 26, 11:25 am, "Gord" <x1gor...@telus.netwrote:
Hello,
I've written a module whose output I write to a table. This table's sole
purpose is to be the recordsource for a report. When the report is loaded,
I am running the module on the 'On load' event. When the report first
opens, it looks like it retrieves the records from the table immediately
before the code has run. The code then runs and updates the table but its
too late for the report to have captured those records.
Is there a command I can use in code (at the end of the procedure of
course)
to force the report to re-retrieve the records from the table? If so, how
do I reference the report in code?
(as you can tell, I'm not an experienced programmer.. just home taught.)
Thanks,
Gord
I think that after you update the table a me.requery should be all you
need to do.