Problem with OutputTo in Access 2007 + Visual Studio 2005

C

creedog

Please forgive me if I'm posting to the wrong group.

I'm converting an application I wrote in Visual Studio 2002 + MS
Access 2002. It was a console application that was executed from an
Access Macro. The application would open up the current Access
Database, it would export a particular report to HTML, then it would
call a webservice on a remote server to send out the exported file via
email to a distribution list.

I'm converting this to Visual Studio 2005 + MS Access 2007, so that I
can export the reports to PDF. Everything converted over just fine,
except that I can no longer call the OutputTo method of the DoCmd
object. Here's the code (VB.Net - VS2005):

Dim oAccess As Access.Application

oAccess = New Access.Application
oAccess.OpenCurrentDatabase("SOMEDATABASEPATH", False)

oAccess.DoCmd.OutputTo(Microsoft.Office.Interop.Access.AcOutputObjectType.acOutputReport,
"Report1", "PDFFormat(*.pdf)", "SOMEEXPORTPATH", False, "", 0,
Access.AcExportQuality.acExportQualityPrint)
oAccess.CloseCurrentDatabase()

oAccess.Quit()
oAccess = Nothing

I've also tried:

Dim oAccess As Access.Application
Dim oCommand As Access.DoCmd

oAccess = New Access.Application
oCommand = oAccess.DoCmd

oAccess.OpenCurrentDatabase("SOMEDATABASEPATH", False)


oCommand.OutputTo(Microsoft.Office.Interop.Access.AcOutputObjectType.acOutputReport,
"Report1", "PDFFormat(*.pdf)", "SOMEEXPORTPATH", False, "", 0,
Access.AcExportQuality.acExportQualityPrint)

oAccess.CloseCurrentDatabase()

oAccess.Quit()
oAccess = Nothing

But I always get the error: "OutputTo' is ambiguous because multiple
kinds of members with this name exist in interface
'Microsoft.Office.Interop.Access.DoCmd'

I guess this is saying that the Access.DoCmd object implements the
interface DoCmd, but it doesn't know what the underlying object type
is? What am I doing wrong here?

Thanks for any help you can provide.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top