id="info"

Question

Locked

Report RecordSource property issue in Access 2002

By ag691234 ·
I have a need to change the saved Report's RecordSource property from VBA code. The record source is one of several saved queries. when the user clicks a command button on a form, the code checks which is the appropriate query to run, and then need to set the RecordSource for a specified report.

The issue I have is when I assign the RecordSource property value in VBA code, I get en error message "You cant set a record source property in print preview or after printing has started." It seems that by assigning the value in format of:
Report_Name.RecordSource = variableName, the code causes the report to be opened.

I need to change the RecordSource property value, then run the report: DoCmd.OpenReport stDocName, acPreview.

Any help on achieving the goal of changing RecordSource property of a report from VBA code in Access 2000 is appreciated.

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Ignore it, I figured this out

by ag691234 In reply to Report RecordSource prope ...

The cause of the problem: I was trying to change the Report's RecordSource property from the code activated by the click of a command button on a form. Instead I needed to move the logic to the code activated by the OnOpen event of the form.

Simple mistake which gave me big headache, simple to fix and to avoid.

Back to Web Development Forum
2 total posts (Page 1 of 1)  

Software Forums