Call Acess db Reports from Excel macro

  • Thread starter Thread starter George
  • Start date Start date
G

George

Hi there again, I need help with calling an specific
report from a specific database using macro. Any help will
be appreciated
 
You get as much help as you can get.
So this is very little help according to your very undetailed question.
 
I`ll try to be more specific, I am creating a macro in an
Excel file, this macro should ask the user what report
from a specific Access database he wants to analyze in the
excel file. I already have the form to ask the user what
reports he wants to see, now I need to create a code that
retrieves whatever report from the specific database.
 
The easies way is to use SQL to retrieve data from ACCESS. However, as far as I am aware, you can qery TABLES and QUERIES only i.e. not REPORTS.
 
George

With Access properly referenced (VBE - Tools - References), use a sub like
this

Sub AnalyzeReport()

Dim acApp As Access.Application

Set acApp = New Access.Application

acApp.OpenCurrentDatabase "C:\Dick\db1.mdb"

acApp.DoCmd.OutputTo acOutputReport, "rptTable 1", _
acFormatXLS, "C:\Dick\Tester\MyReportl.xls", True

acApp.Quit

Set acApp = Nothing

End Sub

Replace rptTable 1 in the OutputTo arguments with the name of the report
selected.
 

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

Back
Top