Recordset using a variable
Posted on 2011-03-02
I have a recordset based off a select query that work fine. Note: It will only ever return one record.
When I try to get the data from the record set it works fine if I explicitly tell it the column name as below:
oldDateResult = rs![The Column Name I Want]
But I have a variable which contains the column name which I need to use,
colName = "[The Column Name I want]"
oldDateResult = rs!colName
This doesn't work, says it can't find the column. I hope I explained it good enough, just need to know how to reference the column name by the use of a variable.