Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Query from Access into Excel cause Access to go to read only | Excel Discussion (Misc queries) | |||
Can I use MS Query in Excel like an Append Query in Access | Excel Discussion (Misc queries) | |||
Microsoft Query rejects "nz" function in Access Query | Excel Discussion (Misc queries) | |||
File conversion query | Excel Discussion (Misc queries) | |||
How to use a Access Query that as a parameter into Excel database query | Excel Discussion (Misc queries) |