|
-
Sep 20th, 2010, 10:17 AM
#1
Thread Starter
Junior Member
[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!
-
Sep 20th, 2010, 10:39 AM
#2
Fanatic Member
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
-
Sep 20th, 2010, 10:48 AM
#3
Thread Starter
Junior Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|