Set Recordsource via VBA?

B

BJC

How can I set the record source of an existing Report
to a SQL string i've built in VBA
and then print the report from VBA.
The help file tells me that i can't refer to a report unless
it is already open. I'm confused. Any Help???

Thanks
 
M

Marshall Barton

BJC said:
How can I set the record source of an existing Report
to a SQL string i've built in VBA
and then print the report from VBA.
The help file tells me that i can't refer to a report unless
it is already open. I'm confused.

You should use the report's Open event to set its
RecordSource property.

If you're trying to do this in a form, you could place the
SQL string in a hidden text box on the form so the report
can copy the string to its property. Just make sure the
form stays open until the report no longer needs to refer to
it.
 

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