Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
tjh tjh is offline
external usenet poster
 
Posts: 96
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
tjh tjh is offline
external usenet poster
 
Posts: 96
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Update database from ODBC query (or another method) Richard Edwards Excel Worksheet Functions 4 June 24th 08 11:47 AM
Open current database method No Name Excel Programming 2 September 30th 04 10:39 AM
Open method used Herminio Excel Programming 10 September 12th 04 03:10 PM
Excel 2003 Workbooks.Open with CorruptLoad=xlRepairFile fails on Excel 5.0/95 file due to Chart, with Error 1004 Method 'Open' of object 'Workbooks' failed Frank Jones Excel Programming 2 June 15th 04 03:21 AM
Workbook Open method Gwen[_2_] Excel Programming 2 June 2nd 04 05:53 PM


All times are GMT +1. The time now is 11:32 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"