Return Value From Recordset - Using Variable as Field Name

  • Thread starter Thread starter lbernarde
  • Start date Start date
L

lbernarde

I want to return the value in a field of a recordset I've created. The field
that I want to return is a variable. I feel like I need to start over and
approach this from a different angle, but thought I would ask to hopefully
avoid going back to the drawing board.

str_field_To_Value = rst_fields!FieldToValue
the part afer the ! needs to be a variable?

Thanks in advance for any help!
 
Assumptions:
rst_Fields is the name of the recordset
fieldToValue is a string that is the name of a field in rst_Fields
str_field_To_Value = rst_fields.Fields(FieldToValue)

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
Back
Top