Support Options
Developer Guide
Syntax
string Object. CreateReport(param1, param2, param3, param4, param5);
Methods
The Access2PDF COM Object has a single method CreateReport.
This method is used to create a PDF file for a
given Microsoft Access report.
Parameters
The CreateReport method takes five (5) parameters.
1. PDF file location
The location where your PDF files will be created.
Example: MyPDFPath = " C:\pdf"
2. PDF file name
The generated PDF is named by Access2PDF in the following manner:
<prefix you define> + .pdf
If the file already exists, the file name will increment, e.g.
<prefix you define> + 1,2,3 ... n + .pdf
OR, submit 'FALSE' and Access2PDF will assign a random 8 digit number
as the file name prefix.
Example: MyPDFNamePrefix = "MyPDF"
3. Path to Microsoft Access database
This parameter requires the complete path and file name. The database can be
either an Access MDB or ADP file.
Example: MyDBName = "C:\Northwind.mdb"
4. Report Name
This is the Name of the report in Access that you want to run.
Example: MyReportName = "Sales Totals by Amount"
5. WHERE clause
The "WHERE" condition for the record source of your Access report.
If you do not want to filter the record set with a WHERE statement,
then set the value of the WHERE condition to "0=0".
Example: MyWhereCondition = "SaleAmount > " &
Request("Sales")
Usage in ASP Pages
<%
' Set Parameter Values
' PARAMETER-1: PDF file location
MyPDFPath = "C:\Program Files\Access2PDF\samples\pdf"
' PARAMETER-2: PDF file name
MyPDFNamePrefix = "MyPDF"
' PARAMETER-3: Path to Microsoft Access
database.
MyDBName = "C:\Program Files\Access2PDF\samples\Northwind.mdb"
' PARAMETER-4: Report Name.
MyReportName = "Sales Totals by Amount"
' PARAMETER-5: WHERE clause
MyWhereCondition = "SaleAmount > " & Request("Sales")
' Create Access2PDF COM Object
Set myPDF = Server.CreateObject("Access2Pdf.clsAccess2Pdf")
' Invoke Access2PDF COM Object
strPdfReturn = MyPdf.CreateReport(MyPDFPath , MyPDFNamePrefix , MyDBName ,
MyReportName , MyWhereCondition )
%>
Usage in Visual Basic
Private Sub InvokeAccess2PDF()
Dim MyPDFPath As string
Dim MyPDFNamePrefix As string
Dim MyDBName As string
Dim MyReportName As string
Dim MyWhereCondition As string
Dim MyPDF As Access2PDF.clsAccess2PDF
Dim strPdfReturn As String
' Set Parameter Values
' PARAMETER-1: PDF file location
MyPDFPath = "C:\Program Files\Access2PDF\samples\pdf"
' PARAMETER-2: PDF file name
MyPDFNamePrefix = "MyPDF"
' PARAMETER-3: Path to Microsoft Access
database.
MyDBName = "C:\Program Files\Access2PDF\samples\Northwind.mdb"
' PARAMETER-4: Report Name.
MyReportName = "Sales Totals by Amount"
' PARAMETER-5: WHERE clause
MyWhereCondition = "SaleAmount > " & Request("Sales")
' Instantiate Access2PDF COM
Object
Set MyPDF = New
Access2PDF.clsAccess2PDF
' Invoke Access2PDF COM Object
strPdfReturn = MyPDF.CreateReport(MyPDFPath,
MyPDFNamePrefix,
MyDBName,
MyReportName, MyWhereCondition)
End Sub
To ask a question, report a problem, or offer a suggestion
please email support@access2pdf.com
Are you looking for development support for your web
application and/or Access database project? Contact us
for information about our software consultation services.
|