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

Report with multiple RecordSources 1

Status
Not open for further replies.

johnaregan

Programmer
Mar 13, 2001
87
Hi
I have a report that I want populated with data from either one of four different databases. Which database is used is controlled from a main form. The application is linked to the SQL Servers using linked tables and I have a query for each linked table. My question is simply how do I set the recordsource in the report? I keep getting an error when I try to set it in the open report event of the report.

thx in advance
John
 
Hi!

Try this code in the command buttons which open the report:

Dim rpt As Report

DoCmd.OpenReport "ReportName", acViewDesign
Set rpt = CurrentDb!Reports("ReportName")
rpt.RecordSource = "TheTableOurQueryYouWant"
Set rpt = Nothing
DoCmd.Close acReport, "ReportName"
DoCmd.OpenReport "ReportName", acViewPreview

hth
Jeff Bridgham
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top