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: 3
Default Access Query Recordet conversion to an Array

Team,
I have a problem with converting a recordset to an array. I am using the
following code to get the array together but my problem is defining the
array dimensions.
I am oversizing the array to contain the data but i need to have exact
sizes. My seond problem is when you bring a recordset in that has various
datatypes how can you get an array to handle the various data types or am i
missing the point with the migration from queries to excel.

My form for this particular problem is to bring in operational data from a
access database and complete vba routines on the data to quickly crunch the
outputs, produce charts, summary diagrams etc.

Thanks if possible in advance
Shane

Set cn = New ADODB.Connection
cn.ConnectionString = Cs
cn.Open

Set cmd = New ADODB.Command
Set cmd.ActiveConnection = cn
cmd.CommandText = Query
cmd.CommandType = adCmdText

Set rs = New ADODB.Recordset
Set rs.Source = cmd

rs.Open

Dim i As Long
Dim j As Long
Dim Data(10000, 100) As Integer



Cells.Select
Selection.ClearContents

i = 1
Do While Not rs.EOF
j = 1
For Each f In rs.Fields
Data(i, j) = f.Value
Cells(i, j) = Data(i, j)
Debug.Print Data(i, j)
j = j + 1
Next f
rs.MoveNext
i = i + 1

Loop


 
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 I use MS Query in Excel like an Append Query in Access Sam Wardill Excel Discussion (Misc queries) 0 April 11th 06 02:41 PM
Microsoft Query rejects "nz" function in Access Query Vaughan Excel Discussion (Misc queries) 0 May 4th 05 05:20 PM
File conversion query Anna Excel Discussion (Misc queries) 3 April 20th 05 02:19 PM
How to use a Access Query that as a parameter into Excel database query Karen Middleton Excel Discussion (Misc queries) 1 December 13th 04 07:54 PM


All times are GMT +1. The time now is 11:50 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"