PDA

Click to See Complete Forum and Search --> : How can I create an array from a table (VBA) ???


StevenSkinner
Mar 8th, 2005, 05:16 AM
Hello,

I need to create an array from a table of bank holiday dates.

I just want some code that run's down each date in "Table1" and writes this information to an array, as this is needed for another VBA function.

Please HELP.

StevenSkinner
Mar 8th, 2005, 05:17 AM
Sorry I forgot to mention, the above is in Access 2000

ivobenkovic
Mar 8th, 2005, 09:01 AM
Hi..

easiest to do this is using method GetRows() of the ADO-RecordSet object.
GetRows() returns a 2 dimensional array.


Dim rs As ADODB.Recordset
Dim va As Variant
Set rs = CurrentProject.Connection.Execute("select * from Table1")
va = rs.GetRows()


visit access 2000 online help for detailed information about GetRows.

Ivo

StevenSkinner
Mar 8th, 2005, 09:11 AM
It could be me, but can not get that code to work correctly at my PC at work ???? :ehh:

NeedSomeAnswers
Mar 8th, 2005, 10:23 AM
What is your error message ??

Have you got a reference to ADO in your database ??