View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson[_3_] Jim Thomlinson[_3_] is offline
external usenet poster
 
Posts: 983
Default open database method

Have you tied

Set dba = nothing

That might work.

"tjh" wrote:

Hello,

I use to methods in Excel VBA to open/and extract data from Access. A
problem I am noticing is when the macro is complete, if I go into my task
manager under processes it shows that Access continues to run, although
Access does not appear to be open at all. How do I prevent this from
happening. Bellow I have shown the two methods I use. This seems to happen no
matter if I use the, dba.Close and dba.DoCmd.CloseDatabase, methods or not.

Thank You,

Dim dba As Access.Application
Dim stgPath As String
Set dba = CreateObject("access.application")
stgPath = ("file.mdb")
dba.OpenCurrentDatabase filepath:=stgPath

and

Set dba = OpenDatabase("file")
Set rst = dba.OpenRecordset("Table", dbOpenDynaset, dbReadOnly)
[a8].CopyFromRecordset rst
'dba.Close