Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I get the information out of a RecordSet?

Status
Not open for further replies.

Quintios

Technical User
Mar 7, 2002
482
US
OK, so now that I have a recordset I'd like to get the values out of it, but something is going wrong.

Here's the SQL string and the corresponding code and error:

Code:
strSQLSource = "SELECT TagName, StepTagName FROM tblStepActions"
    strSQLSource = strSQLSource & " WHERE TagName = " & "'" & Me.TagName & "'"

'Then I have a loop to look at the data:

    Do While Not rsTag.EOF
        Debug.Print "AbsPos :" & rsTag.AbsolutePosition
        Debug.Print "Value  :" & rsTag(rsTag.AbsolutePosition).Value
        rsTag.MoveNext
    Loop

I get an error "Item Not Found in this Collection" on the debug.print line for "Value". It errors out on the third loop when the absoluteposition is equal to two. There are definitely six separate records in the table, however (and this might be the problem) the values in the field 'TagName' are exactly the same, but the values in "StepTagName" differ. Autonumber is used as the primary key for this table.

How do I fix this? Do I need to include the autonumber field in the SQL statement in order to pull out all the records? Why is that?

Thanks in advance,
Onwards,

Q-
 
Never mind. Got it taken care of. It seems that the 'AbsolutePosition' thingy doesn't do exactly what I thought it would...
Onwards,

Q-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top