Is There a Macro Command to Refresh Form Before Printing Report??

J

JessiRight77

I have a form with several tab controls. I also have a subform on the
main form.


I have placed a command button on the main form that calls a macro that
displays a report for the individual record that is currently active.
This works fine, EXCEPT I cannot figure out how to make the macro also
refresh the form before it displays the report for a new/revised
record. (My report is based on a query that includes the primary key
of the underlying table).


Various things I have tried:
1. inserting a "Requery" command (with no argument) before the
"OpenReport" command... but this displays the report for the FIRST
record, not the current record.

2. adding the name of the tab control to the argument section of the
Requery command... but this doesn't work either.

3. making the macro close and open the form *before* printing the
report... but when the form re-opens, it then displays the report for
the FIRST record.

With regard to attempt #3, I also thought about making the macro assign
the primary key of the current record to a variable before it closes,
so it can go back to that record when it re-opens... but I don't see a
command for that.

Does anyone have thoughts or suggestions on how I can do this?

Thanks,
Jessi
 
A

Allen Browne

To save any changes to the current record, use the RunCommand action, and in
the lower window SaveRecord.

I must admit that is not the kind of thing you are likely to stumble across
by accident, as there are 500+ possibilities with RunCommand.
 
J

JessiRight77

Thank you so much! I will not be able to try this for several days,
but it sounds exactly like what I need.

Thanks again,
Jessi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top