Results 1 to 3 of 3

Thread: [RESOLVED] Getting Records from an ADO RecordSet

  1. #1
    Junior Member
    Join Date
    Aug 10
    Location
    Georgia
    Posts
    30

    Resolved [RESOLVED] Getting Records from an ADO RecordSet

    I have a DAO RecordSet object which holds all records from a field. I am attempting to get the names of the records from the RecordSet, but am unable to do so. Here is the code I have so far:

    strTable is a table name
    fld is a Field object

    Code:
    Dim fldRecordSet As DAO.recordSet
    Set fldRecordSet = database.OpenRecordset("SELECT DISTINCT " & strTable &".[" & fld.name & "] FROM " & strTable)
    I know the recordSet has data, the count was 1086 or something close to that. I just dont know how to get the record names from the recordset. Thanks for any help!

  2. #2
    Fanatic Member InvisibleDuncan's Avatar
    Join Date
    May 01
    Location
    Eating jam.
    Posts
    758

    Re: Getting Records from an ADO RecordSet

    This may not be exact, but something along these lines should help. You'll obviously have to change things depending on what you want to do with the data - I'm just sticking it in a string variable.

    Code:
    Dim strFieldData as String
    Do While Not fldRecordSet.EOF
        strFieldData = fldRecordSet.Fields(fld.name).Value
        fldRecordSet.MoveNext
    Loop
    Indecisiveness is the key to flexibility.

    www.mangojacks.com

  3. #3
    Junior Member
    Join Date
    Aug 10
    Location
    Georgia
    Posts
    30

    Re: Getting Records from an ADO RecordSet

    That got me in the right direction. Thanks!

Posting Permissions

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