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

  • Thread starter Thread starter Rob
  • Start date Start date
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?
 
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
 
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?
 
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.
 
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.
 
Back
Top