Set Recordsource via VBA?

  • Thread starter Thread starter BJC
  • Start date Start date
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
 
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.
 
Back
Top