looking up a report from a seperate db

dan-cat

Registered User.
Local time
Today, 09:43
Joined
Jun 2, 2002
Messages
3,415
Hello,

In one db (db1) I am creating a temp table (tblTemp) which details a booking id and letter id. In the second db (db2) I have several reports (over 70) whose names match all possible values within the letter id. I would like to open a report contained within db2 from db1.

ie If letter id in tblTemp within db1 equals ASAA then open report ASAA contained within db2

If the report is contained within the same db then I came up with this:

DoCmd.OpenReport DLookup("LetterId", "tblTemp"), acViewPreview, "", "", acNormal
' There is only ever one record within tblTemp

This seems to work fine - however I would very much like to keep these 70+ reports in a seperate db.

Is there anyway I can adapt the above code to make it open the appropriate report which is contained in a seperate db?

ThankYou

Dan

PS - this is such a great forum - the people who run it should be proud!
 
Dim ac As Access.Application
Set ac = New Access.Application
' open the database.
ac.OpenCurrentDatabase ("C:\POSDat\prt\prt.mdb")
' uncomment the line below if you want to see Print Preview
'ac.Visible = True
' replace the acViewNormal below with acViewPreview
' if you want to see Print Preview
ac.DoCmd.OpenReport "Racun2", acViewNormal
ac.CloseCurrentDatabase
 
thanks cam - that worked a treat
 

Users who are viewing this thread

Back
Top Bottom