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

Record source

Status
Not open for further replies.

samotek

Technical User
May 9, 2005
197
BG
Can i define the record source of the report in the command line opening the report ? I know how to place the record source in the OnOpen event of the report but i do not know is it posible to do it in the command line:
DoCmd.OpenReport "R1, acPreview, , "" Reports! R1.recordsource = "qry1"
Unfortunately the above command line is not accepted by Access.

 
You may be able to do it by "OpenArgs". See help file for more details.
If you need a sample then check my site that has two sample dbs using OepnArgs for form. Same applies to reports.


________________________________________________________
Zameer Abdulla
Help to find Missing people
My father was a realistic father; not a vending machine dispense everything I demanded for!!
 
Just remember that OpenArgs for reports became available starting with the 2002 (xp) version, which poses a challenge for some of us having to maintain apps that need to work also on earlier versions.

Some try to push information to the report with something like this

[tt]DoCmd.OpenReport "NameOfReport", acPreview
reports("NameOfReport").recordsource = <recordsource>[/tt]

but - I don't know whether it works or not, cause I've never used this method.

What I'd do, if OpenArgs isn't an option, is either using a public variable in which you "stuff" the recordsource (string) prior to running the open command, or from the on open event, do a selection based on for instance values in a form control in the calling form.

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top