show report in visual basic application

  • Thread starter Thread starter tweetie22
  • Start date Start date
T

tweetie22

Guest
Hi, I am Using VB 6 and access 2000, I have Developed a program with VB, and everything is there but now I need VB to take a Report made in Access, how do I do that?
 
1. Create a macro inside of access that opens the report.
2. From VB you can open the access database and specify which macro to run.

example of vb code:

Shell "c:\program files\microsoft office\office\msaccess.exe db1.mdb /x mymacro"

of course you will have to adjust the path, database, and macro name accordingly.
 
FoFa's code is good -- the following works too, assuming the Access Reference Library is added to your project.

Code:
Dim acApp As Access.Application
Set acApp = New Access.Application

'path to DB file
acApp.OpenCurrentDatabase ("\\servername\FolderXYZ\DB1.mdb")
acApp.DoCmd.OpenReport "Rpt1" 'send rpt to printer
acApp.CloseCurrentDatabase
Regards,
Tim
 

Users who are viewing this thread

Back
Top Bottom