PDF Making in Access 2003

nj_best

Registered User.
Local time
Today, 13:56
Joined
Jul 11, 2015
Messages
12
Sir.
How to make pdf file in access 2003.
i want to make pdf of a report in access 2003.
plz tell me or give me vba code.
Thnaks.
Looking for CJ_LONDON and VBAInet.........:(
 
docmd.OutputTo acOutputReport ,"rptReport",acformatpdf,"c:\folder\file.pdf"
 
how and where to use it ??
in export page there is no pdf option in access 2003
 
Last edited:
Oh, for that older version, I had to set the PDF engine to always write to a file,
C:\pdf\generic.pdf

Then after access writes the file,(sent to PDF printer) the vba code would rename the file to that of the report.
 
Ranman sir
i could not understand. caz i am beginner.
plz tell me where this code apply and how. ?\
Thanks
 
In the button to PRINT, the button_click event.
once you configure the adobe writer (or other) to always print to the same file:
C:\pdf\generic.pdf

I have a list box of reports for the user to choose (lstRpts)
then the button click event has:

Code:
sub btnPrint_Click()\
dim i as long

DoCmd.OpenReport lstRpts      'if pdfwriter is the default printer, then it goes to the file.  

'timer delay so the report can print to file

   For i = 1 To 100000  'slow down until PDF gets written
   Next

If Dir(mvSrcFile) <> "" Then     'is the file there yet

   Name "C:\pdf\generic.pdf" As "C:\pdf\" & lstRpts & ".pdf"
end if
end sub
 
In the button to PRINT, the button_click event.
once you configure the adobe writer (or other) to always print to the same file:
C:\pdf\generic.pdf

I have a list box of reports for the user to choose (lstRpts)
then the button click event has:

Code:
sub btnPrint_Click()\
dim i as long

DoCmd.OpenReport lstRpts      'if pdfwriter is the default printer, then it goes to the file.  

'timer delay so the report can print to file

   For i = 1 To 100000  'slow down until PDF gets written
   Next

If Dir(mvSrcFile) <> "" Then     'is the file there yet
   Name "C:\pdf\generic.pdf" As "C:\pdf\" & lstRpts & ".pdf"
else
   msgbox "report is slow to print"
end if
end sub
 
No knowing any better I created my pdf files, by printing to a pdf driver.

My only problem was having the correct name of the file, so got around this by copying the report as the shipname, printing it, and then deleting that report.

Perhaps not the best way, but it works. :)

Here is my code for one such print

Code:
Private Sub cmdShip_Click()
On Error GoTo Err_cmdShip_Click

    Dim stRptName As String, stParam As String, stLinkCriteria As String
    Dim iPreview As Integer, iDialog As Integer
    
    iPreview = 0
    iDialog = 0
    If Me.ChkPreview Then
        iPreview = 2
        iDialog = 3
    End If
    stRptName = "Main_by_Ship"
    
    stParam = Replace(LCase(Me.cboShip.value), " ", "_")
    stLinkCriteria = "[Ship] = '" & Me.cboShip.value & "'"
    
    DoCmd.CopyObject , stParam, acReport, stRptName
    DoCmd.OpenReport stParam, iPreview, , stLinkCriteria, iDialog

    DoCmd.Close acReport, stParam
    DoCmd.DeleteObject acReport, stParam

Exit_cmdShip_Click:
    Exit Sub

Err_cmdShip_Click:
    MsgBox Err.description
    Resume Exit_cmdShip_Click
    
End Sub

HTH
 
never seen/used it.
But if you can control the filename the it produces, then use that.
 
As it exports, you get a file dialogue box that lets you enter a filename for the exported PDF.

SHADOW
 
As it exports, you get a file dialogue box that lets you enter a filename for the exported PDF.

SHADOW
Does it start with a generated filename?

When I run my code I have to produce about 30 reports, but all I have to do is click Ok 30 times. No need to enter any names.?
 

Users who are viewing this thread

Back
Top Bottom