GetObject in Access 2007 Beta 2

G

Guest

The GetObject method seems to intermittently fail in Access 2007 Beta 2. A
code snippet is below:

Dim oApp as Object
Set oApp = GetObject(“C:\Example.mdbâ€)

Sometimes this correctly sets oApp to the access database and sometimes it
fails with Run-time error -2147467259 (80004005), Automation error,
Unspecified error.

Does anyone know of a solution for this problem?
 
S

strive4peace

I have not done this with Access, but I use GetObject and
CreateObject with Excel -- here is an idea you can adapt

'if Excel is already open, use that instance
'this will generate an error if it is not open
'so we will ignore it
On Error Resume Next
Set xlApp = GetObject(, "Excel.Application")
On Error GoTo error_handler

'What did we find?...
If TypeName(xlApp) = "Nothing" Then
'Excel was not open -- create a new instance
Set xlApp = CreateObject("Excel.Application")
End If


Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day ;)

remote programming and training
strive4peace2006 at yahoo.com

*
 

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