Call a report in another .mdb-file from a .mde-file

R

Rob

Hello all,
In order to protect my access file i distribute it as a .mde file.
But
Some users want to make changes in the layout of one of the reports but they
cannot change anything in a .mde or .accde file.

My question:
Is it possible to call a report (with a WHERE-clause) in a separate .mdb
file from within code in a .mde file?
 
T

Tom van Stiphout

On Thu, 29 Jan 2009 00:09:05 -0800, Rob

Yes. We did this a few years back for one of our clients. Essentially
you need to use Automation to create an Access object and invoke the
report.

-Tom.
Microsoft Access MVP
 
R

Rob

Hi Tom, thank you for replying...
Automation, ok....that rings a bell :) but no more than that...
Can you give me one more clew how to achieve that?
 
F

fredg

Hi Tom, thank you for replying...
Automation, ok....that rings a bell :) but no more than that...
Can you give me one more clew how to achieve that?

Try this:

Public Sub OtherDbReport()
' Run a report located in a different database
Dim appAccess As Access.Application

Set appAccess = CreateObject("Access.Application")
appAccess.OpenCurrentDatabase "C:\My Folder\OtherDb.mdb"
appAccess.DoCmd.OpenReport "ReportName", acViewDesign
appAccess.Quit
Set appAccess = Nothing
End Sub

Change acViewDesign to acViewPreview if you wish to see the report in
preview instead of Design. The user can then switch the view to design
using the View tool button. Note: Any change made to the report is
saved when the report closes.
 
R

Rob

Perfect, exactly what i needed
Thank you

fredg said:
Try this:

Public Sub OtherDbReport()
' Run a report located in a different database
Dim appAccess As Access.Application

Set appAccess = CreateObject("Access.Application")
appAccess.OpenCurrentDatabase "C:\My Folder\OtherDb.mdb"
appAccess.DoCmd.OpenReport "ReportName", acViewDesign
appAccess.Quit
Set appAccess = Nothing
End Sub

Change acViewDesign to acViewPreview if you wish to see the report in
preview instead of Design. The user can then switch the view to design
using the View tool button. Note: Any change made to the report is
saved when the report closes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top