Hi,
I have a report where I am populating text box values from an adodb recordset. The following works fine to preview the report:
Dim rptTest as Report
DoCmd.OpenReport "rptTester", acPreview
Set rptTest = Reports!rptTester
Call rptTest.Populatefields(rs)
The report opens and the fields are filled out as I have specified in the populatefields method.
However, if I change acPreview to acViewNormal (to print instead of preview), I get the error "the report name rptTester you entered is misspelled or refers to a report that isn't open or doesn't exist" when the code tries to execute the 'set' statement above. Presumably, as the report closes automatically after being printed, it's no longer in scope.
My question is, how can I open a report, call a method to populate some text boxes with a recordset, and then print it?
Thanks for any advice.
I have a report where I am populating text box values from an adodb recordset. The following works fine to preview the report:
Dim rptTest as Report
DoCmd.OpenReport "rptTester", acPreview
Set rptTest = Reports!rptTester
Call rptTest.Populatefields(rs)
The report opens and the fields are filled out as I have specified in the populatefields method.
However, if I change acPreview to acViewNormal (to print instead of preview), I get the error "the report name rptTester you entered is misspelled or refers to a report that isn't open or doesn't exist" when the code tries to execute the 'set' statement above. Presumably, as the report closes automatically after being printed, it's no longer in scope.
My question is, how can I open a report, call a method to populate some text boxes with a recordset, and then print it?
Thanks for any advice.