Return ADODB recordset value?

MaximusArcher

Registered User.
Local time
Today, 06:15
Joined
Apr 7, 2005
Messages
15
Say I have an ADODB recordset with two fields in it called 'FirstName' and 'LastName'.

I want to return the values into variables which is normally done as...

strValue1 = rst![FirstName]
strValue2 = rst![LastName]

However, what I want to do is assign the field to retrieve to a variable also and then use this variable to identify which field to query.

sort of like

strFieldName = "LastName"
strValue1 = rst![strFieldName]

is it possible, a better way?

thanks,
Matt.
 
Last edited:
I think:
strFieldName = "LastName"
strValue1 = rst.fields(strFieldName)
should work.
 

Users who are viewing this thread

Back
Top Bottom