Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2009
    Posts
    8

    Unanswered: extracting fields into an array

    I want to perform a complex find maximum on a field called cardno and I have an idea in my head how I will do it with vba but I can't find any info on how to take the list of card numbers and put them into an array. is this possible?

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Search in Access help for the GetRows method of a DAO RecordSet. Without any information about your database and its structure I cannot be more precise.
    Have a nice day!

  3. #3
    Join Date
    Sep 2009
    Posts
    8
    ok fair enough
    the table is like this

    CardNo | CrdPersonID | CrdLastRenew | RenewStatus
    xxxxx xx xx/xx/xx sdfg
    xxxxx xx xx/xx/xx sdfg
    xxxxx xx xx/xx/xx sdfg
    xxxxx xx xx/xx/xx sdfg
    couldn't get the spaces to stay ^^^ but you get the idea

    I wanna take all the card numbers out and put them into an array so I can mess with them

  4. #4
    Join Date
    Sep 2009
    Posts
    8
    got it! took ages of fluffing around bit I've finally got it working... thankyou.

    Dim dbs As DAO.Database
    Dim rst As DAO.Recordset
    Dim vList() As Variant
    Dim sList() As String
    Dim i As Integer
    Dim x As Integer
    Set dbs = CurrentDb
    Set rst = dbs.OpenRecordset("SELECT CARDNO FROM CARDHOLDERS")
    rst.MoveLast
    rst.MoveFirst
    x = rst.RecordCount
    vList = rst.GetRows(3)
    ReDim sList(UBound(vList, 2))
    For i = 0 To UBound(vList, 2)

    sList(i) = CStr(vList(0, i))

    Next

Posting Permissions

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