Hi,
I have a report with the Record Source Qry1. 99% of the time, I want it to open with Qry1 as its record source, but when a certain button is pressed I want its record source to change to Qry2.
Ive looked this up on the net, and i seem to be getting conflicting information, some saying you cant do it when the report is open, others saying you cant do it when its closed.
Because of the way its set up i dont really want to have anything in the OnOpen comand of the report, so is there a way to change it in the VBA code of the button which opens the report?
I tried:
DoCmd.OpenReport "RepCtrForm", acViewPreview
Me.RecordSource = "Qry2"
but that didnt seem to work.
Any ideas/information would be greatly appreciated. Thank you!
I have a report with the Record Source Qry1. 99% of the time, I want it to open with Qry1 as its record source, but when a certain button is pressed I want its record source to change to Qry2.
Ive looked this up on the net, and i seem to be getting conflicting information, some saying you cant do it when the report is open, others saying you cant do it when its closed.
Because of the way its set up i dont really want to have anything in the OnOpen comand of the report, so is there a way to change it in the VBA code of the button which opens the report?
I tried:
DoCmd.OpenReport "RepCtrForm", acViewPreview
Me.RecordSource = "Qry2"
but that didnt seem to work.
Any ideas/information would be greatly appreciated. Thank you!