HResult 0x800A0C4F When Run Access Report from VB 2008


E

Ebassador

VS 2008 with Office 2007. Using .Net 3.5 and interop services.

When oAccess.Run is executed, error results as shown above.

Here is the code:

Friend Function doReport(ByVal rName As String,
Optional ByVal sView As Access.AcView = Nothing, _
Optional ByVal sFilter As String = "", _
Optional ByVal sWhere As String = "") As Boolean
Dim oAccess As Access.Application = CreateObject("Access.Application")

oAccess.Visible = False
oAccess.OpenCurrentDatabase(getConfigVar("dbLocation", True, True))
oAccess.DoCmd.Minimize()
oAccess.Visible = True
oAccess.Run("OpenAccRpt", rName, sView, sFilter, sWhere & " ")
oAccess.DoCmd.Maximize()
doReport = True
End Function
 
Ad

Advertisements

J

Jack Leach

oAccess.Run("OpenAccRpt", rName, sView, sFilter, sWhere & " ")

Try replacing with

oAccess.DoCmdOpenReport <report>, <view>, <filter>, <where>

hth
--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)
 

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