open database method

T

tjh

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
 
T

tjh

Do you mean after the statements below are complete is when I should set dba
= nothing?



Jim Thomlinson said:
Have you tied

Set dba = nothing

That might work.

tjh said:
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
 

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

Similar Threads


Top