Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report RecordSource

Status
Not open for further replies.

matrixindicator

IS-IT--Management
Sep 6, 2007
418
BE
I have a report, it should change the recordsource (query) depending on a change button if on (true). Below code is not working 100% Because he said the name of the report is not correct spelled. What is the good way to change recordsource of a report ?

Code:
   DoCmd.OpenReport "R01_ETIKET", acViewReport
    Reports!R01_ETIKET.RecordSource = "QS_T02_ORDER"
    DoCmd.OpenReport "R01_ETIKET"
 
I would base the report on a saved query and then use a little DAO code to change the SQL property of the query.

It's a bit unusual to change the record source. Typically you should be able to simply change the criteria to report a different subset of records.

Duane
Hook'D on Access
MS Access MVP
 
For this application I while use a simple solution (a bit against the idea to avoid redundancy). I will simple copy my report and set a different recordsource for each. With a if statement the print button on my form can switch between the two.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top