Opening Access reports from VB program (1 Viewer)

Chanda

New member
Local time
Today, 07:44
Joined
Jan 7, 2000
Messages
7
Everyone,
This isn't strictly a Access question, but...this group has proven to be very knowledgeable!

Does anyone know how to open/view/print a Access report from a Visual Basic 6.0 program? I think its something like this:

Dim appAccess As Application
Dim msReport As String
msReport = "Report1"
Set appAccess = New Access.Application
appAccess.DoCmd.OpenReport msReport,acPreveiw

That is as far as I got, and it doesn't work!
I'm not sure if I'm missing part, or even going about it the right way.
Any help would be greatly appreciated!
Thanks in advance,
Chanda
 

bobjames

Registered User.
Local time
Today, 07:44
Joined
May 8, 2000
Messages
23
Your gonna have to tell what DB you gonna open the report in. In other words what DB has this report in it.

And I'm not sure if you can use Access specific constants like acPreview from VB. You may have to pass the actual value of the constant.
 

Ron Bell

Registered User.
Local time
Today, 07:44
Joined
Jul 25, 2000
Messages
33
This version uses late binding but I think the priciples are the same

Public appAccess As Access.Application

Set appAccess = CreateObject("Access.Application")
With appAccess.Application
.OpenCurrentDatabase ("root and filename of db")
.Run "runreports", "reportname"
.DoCmd.Maximize
.Visible = True
End With

Set appAccess = Nothing

In yr db create in module a routine "runreports" (or whatever name) and this will have DoCmd.OpenReport... in it

or just substitute .Run..... above with .DoCmd.OpenReport..... etc

[This message has been edited by Ron Bell (edited 12-29-2000).]

[This message has been edited by Ron Bell (edited 12-29-2000).]
 
S

sudhakaratp

Guest
Passing Parameter to Create Report

Hi,

Now, I have to create a New Report in Ms-Access. The name for the report has to be passed from VB application wherein the user will enter the name for the report. Then, again, I should open this report (again passing the report name as parameter) to open and show the user wherein he can design the report.

I am not able to find the code for this. Could anyone help me on this.

Regards
Sudhakara.T.P.
 

Users who are viewing this thread

Top Bottom