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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

set a reports recordsource programmatically 1

Status
Not open for further replies.

jmodo

Programmer
Aug 2, 2006
43
US
I need something like
aReport.RecordSource = myString
?
I know there are QueryDefs and TableDefs, but I'm not sure how to deal with reports.

I am dynamically setting the recordsources of the reports, because of some filtering i have in place.

thanks!
 
I can't directly access the recordsource from there. Is there another way. It would be much easier for me to access the recordsource than modifying the criteria, which is all that I see is possible with DoCmd.OpenReport

thanks. -J
 
In order to get to the Recordsource property of the report thru code, the report will have to be open. BUT, if you open the report first, then you can't change the Recordsource. So, the only way I see to do it is to use Docmd.OpenReport. Perhaps someone else knows of another way. Sorry...I tried.
 
Thanks! I've googled, and I think that is the only way also. I think I'm going to try using the OpenArgs to pass the recordsource string to the report_open(). Maybe i'll change it to your way if this doesn't work.

J
 
I know you can set captions and other properties programmatically by turning off warnings, opening in design mode, changing and saving. Have you tried this for recordsource?

HTH,

Alex

It's a magical time of year in Philadelphia. Eagles training camp marks the end of another brutal season of complaining about the Phillies.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top