Make a report show content from an external Database

  • Thread starter Thread starter TimDGCB
  • Start date Start date
T

TimDGCB

Hi,

I have created an interface in access witch lets the user select a
database file so he can edit this. So i have a database file with forms
and a database file with al my data. For reading in the data from my
external database I use something like folows in my Form_Load Event:

Dim db As Database
Dim qdf As QueryDef
Dim rs As Recordset

Set db = OpenDatabase("ExternDatabaseName.mdb")
Set qdf = db.CreateQueryDef("", "SELECT * FROM Table")
Set rs = qdf.OpenRecordset(dbOpenDynaset)

Set me.Recordset = RS

Now that this works in my forms I want to acomplish a similar thing to
create my reports. The sad thing is that the above code dosn't seem
work with reports. It seems to be the case that a report doesn't has
the Recordset propery. So has anyone an idee how I can solve this
problem?

Thanks:

Tim De Graeve
 
Is there a reason why you don't maintain linked tables?

You can create a query or modify the sql of a query to something like:

SELECT *
FROM Employees IN 'C:\Program Files\Microsoft
Office\Office10\samples\Northwind.mdb';

This would allow you to create a record source for your report.
 
Back
Top