Results 1 to 7 of 7
  1. #1
    jo15765's Avatar
    jo15765 is offline Expert
    Windows XP Access 2000
    Join Date
    Nov 2010
    Location
    6 Feet Under
    Posts
    672

    take access table into array

    I have a table with one field - zip and I want to take that data from the table, put it in an array and cycle the elements of the array.



    What's the VBA syntax to do such?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Why do you need array? Why not a recordset and cycle through the recordset? Would have to do that anyway to populate the array.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    jo15765's Avatar
    jo15765 is offline Expert
    Windows XP Access 2000
    Join Date
    Nov 2010
    Location
    6 Feet Under
    Posts
    672
    Not sure....can you provide code to do as such?

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Review http://allenbrowne.com/ser-29.html

    See item 5 for looping.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    You may also see thjs tutorial.

  6. #6
    jo15765's Avatar
    jo15765 is offline Expert
    Windows XP Access 2000
    Join Date
    Nov 2010
    Location
    6 Feet Under
    Posts
    672
    Quote Originally Posted by June7 View Post
    Review http://allenbrowne.com/ser-29.html

    See item 5 for looping.
    Taking a look at the link you provided I see the following code
    Code:
       Do while Not rst.EOF
            If rst![MyField] <> Something Then  'The real loop exit condition.
                Exit Do
            End If
            ' Rest of your code here.
            rst.MoveNext
        Loop
    I am wanting to open that database and link a table (I have the VBA to import a table just have never done it this way before). Would my code go in the 'Rest of your code here since it doesn't matter what MyField is equal to?

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I have no idea if your code should go there because I have no idea what you are trying to accomplish.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Defining an Array in an Access Table
    By EddieN1 in forum Database Design
    Replies: 9
    Last Post: 10-10-2014, 08:09 AM
  2. Replies: 2
    Last Post: 01-08-2013, 04:59 PM
  3. retrieve table contents from an array
    By bonecone in forum Programming
    Replies: 1
    Last Post: 05-22-2012, 12:51 PM
  4. Replies: 3
    Last Post: 05-23-2011, 02:15 PM
  5. Access 2007 Array issue
    By phpuser123 in forum Access
    Replies: 1
    Last Post: 11-04-2010, 01:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums