Results 1 to 5 of 5

Thread: How can I create an array from a table (VBA) ???

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2005
    Location
    Essex
    Posts
    14

    Question How can I create an array from a table (VBA) ???

    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.
    Steve

  2. #2

    Thread Starter
    New Member
    Join Date
    Mar 2005
    Location
    Essex
    Posts
    14

    Re: How can I create an array from a table (VBA) ???

    Sorry I forgot to mention, the above is in Access 2000
    Steve

  3. #3
    Junior Member
    Join Date
    Mar 2005
    Location
    Kaiserslautern, Germany
    Posts
    25

    Re: How can I create an array from a table (VBA) ???

    Hi..

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

    VB Code:
    1. Dim rs As ADODB.Recordset
    2. Dim va As Variant
    3. Set rs = CurrentProject.Connection.Execute("select * from Table1")
    4. va = rs.GetRows()

    visit access 2000 online help for detailed information about GetRows.

    Ivo

  4. #4

    Thread Starter
    New Member
    Join Date
    Mar 2005
    Location
    Essex
    Posts
    14

    Re: How can I create an array from a table (VBA) ???

    It could be me, but can not get that code to work correctly at my PC at work ????
    Steve

  5. #5
    Superbly Moderated NeedSomeAnswers's Avatar
    Join Date
    Jun 2002
    Location
    Manchester uk
    Posts
    2,657

    Re: How can I create an array from a table (VBA) ???

    What is your error message ??

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width