ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   open database method (https://www.excelbanter.com/excel-programming/317276-open-database-method.html)

tjh

open database method
 
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

Jim Thomlinson[_3_]

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


tjh

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



"Jim Thomlinson" wrote:

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



All times are GMT +1. The time now is 05:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com