print access report into pdf files using VB6

  • Thread starter Thread starter cdolphin88
  • Start date Start date
C

cdolphin88

Hi,

I'm trying to convert the access I have written in access into a pdf, I
used this code below, but somehow it gave me an error user defined type
not defined, so I guess it's because I need to add a reference, but
which one? Can someone tell me?

Cheers!

Claudia


Dim objPDF As New PDFClass
With objPDF
.ReportName = "RptCollection"
.OutputFile = "c:\testing.pdf"
.PDFEngine = 1
.PrintImage
End With
 
Claudia:

If you are trying to reference our PDF and Mail library class in VB6, it
won't work. How you need to do it is to create a function in the Access
db module to output the PDF file, using the code like you have below. Then,
in VB6 using the Application.Run method to call the function in the Access
db.

E.g.

Dim objAcc as object
Set objAcc = CreateObject("Access.Application")
objAcc.OpenCurrentDatabase ("c:\some db.mdb')
objAcc.Run "NameOfPDFFunctionInAccessDb", Param1, Param2
DoEvents
objAcc.CloseCurrentDatabase
objAcc.Quit
SetObjAcc = Nothing
 
Back
Top