Click to See Complete Forum and Search --> : Printing MS Access Reports


August 14th, 1999, 03:08 PM
Hi,

Does anyone know if it is possible to print an already made MS Access report from VB? If so, does it require you to have MS Access installed on your machine?

Thanks.

Praba S
August 16th, 1999, 02:32 AM
Hi


Follow this URL to c what u want
http://www.codeguru.net/bbs/wt/showpost.pl?Board=vb&Number=5367&page=0&view=collapsed&sb=5#Post5367

Yes MS Access should me loaded

Good Luck Praba

mlamelas
November 16th, 1999, 02:52 PM
Is this URL still valid? I tried accessing it and got a not found error. Can you repost the answer to the question? I would like to print an Access report from a VB program. Thanks.

Mel Lamelas

Praba S
November 16th, 1999, 07:38 PM
Hi,

U need Acces97 installed.
Create mdb biblio97.mdb (biblio.mdb will be in ur harddisk)
Create a sample report, name it as "report1"

create vb project.
add a new form. Add command button in this form.
Copy the code given below in the module area of the form. Change path if required for Mdb.
run the project , click the button, "report1" will be printed.

Regards
Praba


Option Explicit

Private Sub Command1_Click()
Dim objAcc As New access.Application

Set objAcc = CreateObject("C:\BIBLIO97.MDB")

objAcc.DoCmd.OpenReport "report1", acNormal
objAcc.CloseCurrentDatabase
objAcc.Quit
Set objAcc = Nothing

End Sub

dtaronna
November 24th, 1999, 05:03 AM
And if I need the preview?? I tried with the acpreview option, but it doesn't work... why??

Praba S
November 24th, 1999, 07:14 PM
use acpreview parameter for OpenReport Method
After this statement put some wait state. u can use API Sleep funnction for this

dtaronna
November 25th, 1999, 02:10 AM
Example, please...