Lots of ways to deal with it. However, the first report I looked at in design view has a recordsource property "WeeklyApplicatorNumberQ" so are you really setting report sql in vba or perhaps you just think that's the case. I've never had both in place at the same time so I can't tell you what you should expect.
So solutions
- leave the report source in place & use the sql to edit the query definition
- you can pass rather long strings to OpenArgs property then set recordsource to that string (few times I've tried never raised an error)
- you could modify the report recordsource property before attempting to open
- could use a staging table that you edit each time and base the report on that. You delete the staging table records in the report close or unload event.
1 and 3 require that you open the object in design view (hidden) modify its property, save, close and reopen.
More ideas to come, no doubt (other than not trying to switch views and modify the property).
Last edited by Micron; 04-20-2022 at 04:08 PM.
Reason: correction
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.