Run-time error '424': Object required

cliftonx

Registered User.
Local time
Today, 04:14
Joined
Mar 4, 2010
Messages
27
Hello,

Could anyone provide some direction as to why I'm getting a 424 runtime error. The error occurs on the first line of the sub function(the 'set rep' statment). The following is the code that I'm using within a module, that causes the error whenever the module gets called, i.e. ExportToPDF(test):

Sub ExportToPDF(ReportFile As String)
Set rep = appl.OpenReport("C:\Clients\ResdasReport\" & ReportFile & ".rpt")
rep.ExportOptions.DiskFileName = "C:\Clients\ResdasReport\" & ReportFile & ".pdf"
rep.ExportOptions.DestinationType = crEDTDiskFile
rep.ExportOptions.FormatType = crEFTPortableDocFormat
rep.Export False
End Sub

The code creates a PDF file from a MS Access report file. Any help would be greatly appriciated.:)

Thanks,
Cliff.
 
Hi and welcome to the forums.

I would guess that you either do not have your references set (e.g., 'Microsoft DAO x.x Object Library" checked, or,

You are using "appl" and you don't have it declared (e.g., Dim appl As Object and Set appl= CreateObject("Access.Application").

-dK
 
I also don't see anywhere where rep is declared.
 

Users who are viewing this thread

Back
Top Bottom