Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Excel/Access connection via ADO

Hi there

I'm using a piece of VBA code to connect to an Access database via ADO from
within Excel.

I'm using a For ... Next loop to access the database many times, and my
queries have a very similar SQL statement structure.

I'm opening and closing the connection to the database with each loop, which
must be very inefficient!!! Certainly the procedure takes an enormous amount
of time to run.

There must be a way to access the database, keeping the connection open?!
I've come across the .Restartable property / .Requery method in the DAO
context, which seems to be the thing I need, but which isn't supported with
ADO.

Please help
Best regards
Loane


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 593
Default Excel/Access connection via ADO

"Loane Sharp" wrote ...

I'm using a piece of VBA code to connect to an Access database via ADO from
within Excel.

I'm using a For ... Next loop to access the database many times, and my
queries have a very similar SQL statement structure.

I'm opening and closing the connection to the database with each loop, which
must be very inefficient!!! Certainly the procedure takes an enormous amount
of time to run.

There must be a way to access the database, keeping the connection open?!
I've come across the .Restartable property / .Requery method in the DAO
context, which seems to be the thing I need, but which isn't supported with
ADO.


You can keep the connection open and keep using it until you need to
close it e.g.

Dim oCon As ADODB.Connection
....
oCon.Open
For i = 0 to 99
oCon.Execute "INSERT INTO ...
Next
oCon.Close

BTW the ADODB.Recordset object does support the Requery method:

http://msdn.microsoft.com/library/de...adorequery.asp

IMO ADO is better than DAO, even when the data source is Jet (for
which DAO is biased). I think DAO is only still used by hardcore MS
Access developers who predate the ADO technology <g.

Jamie.

--
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
Excel 2010 (64 bit) External Data connection with Access Bill Carlson Excel Discussion (Misc queries) 0 June 2nd 11 12:10 AM
reconnecting a workbook connection from Access-Excel Steven Cheng Excel Discussion (Misc queries) 0 December 11th 08 04:46 PM
Excel data connection to Access Sharon Excel Discussion (Misc queries) 1 February 14th 08 08:33 PM
Can Excel and access update each other like a two way connection CmK Excel Discussion (Misc queries) 0 February 23rd 07 01:01 PM
Cut the umbilical cord? Access connection to Excel Toby Erkson[_2_] Excel Programming 5 May 7th 04 08:05 PM


All times are GMT +1. The time now is 10:27 PM.

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"