Recordset object field reference

heartdata

New member
Local time
Yesterday, 21:25
Joined
Aug 13, 2010
Messages
2
I want to be able to reference a field in a recordset object using a variable (value assigned by user input) rather than directly by field name.

Rather than
rstMyRecordset!MyField

I want to replace MyField with a variable. What is the correct syntax?
 
This is off the top of my head, but try

rstMyRecordset.Fields(VariableName)
 
Thanks! That did the job!
 
I am pretty sure you can also do it more simply like this:
rstMyRecordset(VariableName)
 
Happy to help. Steve is probably right; I don't think I've ever used variables for the field names, so never really needed it.
 

Users who are viewing this thread

Back
Top Bottom