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

Hi there

I'm a beginning ADO user ... please help!

Is there a more efficient and less time-consuming way to achieve the
following effect (pulling Access data into Excel) ...?

I have two different *.mdb files with identical field etc. structures
(really a single database that is bigger than 2GB and that I've split into
two files). A given piece of analysis in Excel requires records from both
files (however I split the database). In each iteration (over 200,000 loops)
I open a connection to the first database and create a recordset and,
thereafter, open a connection to the second database and create a new
recordset. The two recordsets are then placed in a contiguous range on an
Excel sheet and I proceed with the analysis from there ...

I've truncated my code below.

Please help

Loane

Dim rsData As ADODB.Recordset
Dim strConnect As String
Dim strSQL As String

For i = 1 to NoRecords

For j = 1 to 2

If j = 1 Then
strConnect = "...\DataBase1.mdb;"
strSQL = "SELECT Field1 FROM Table1 WHERE Index = i"
ElseIf j = 2 Then
strConnect = "...\DataBase2.mdb;"
strSQL = "SELECT Field1 FROM Table2 WHERE Index = i"
End If

rsData.Open strSQL, strConnect, adOpenForwardOnly, adLockReadOnly,
adCmdText

Cells(i, 1).CopyFromRecordset rsData

rsData.Close

Next j

[Some code representing Excel-based analysis goes in here. The analysis
currently requires that the data in the two recordsets (i.e. drawn from
Table1 and Table 2, respectively) be deposited in a contiguous range in a
worksheet.]

Next i

Set rsData = Nothing


 
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
Query from Access into Excel cause Access to go to read only T Stephens Excel Discussion (Misc queries) 0 March 24th 09 04:17 PM
Can Excel access data from Access?! Al Excel Discussion (Misc queries) 5 April 5th 08 03:52 PM
export access to excel. change access & update excel at same time fastcar Excel Discussion (Misc queries) 0 June 24th 05 09:27 PM
access--excel--access Tim Excel Programming 2 February 6th 04 11:41 AM
How to access ACCESS from Excel! Gordon Cartwright[_2_] Excel Programming 3 November 8th 03 11:50 AM


All times are GMT +1. The time now is 04:23 PM.

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

About Us

"It's about Microsoft Excel"