I am trying to set the value of each property of an object. However, I do not want to have to hardcode the call to each property individually. I am trying to pass in a recordset of all of the property names and values. The object's property names match the recordset field names. I keep getting a "method or data member not found" error. Here is the code I am trying:
-----------------------------------------
maxFields = rs_MetaData.Fields.Count
For i = 0 To maxFields - 1
'Dynamically reference m_objMetaData properties using the name of each field in the rs_MetaData recordset
m_objMetaData.[rs_MetaData.Fields(i).Name] = rs_MetaData.Fields(i).Value
Next
------------------------------------------
The problem is "m_objMetaData.[rs_MetaData.Fields(i).Name]". I don't know the correct syntax for dynamically referencing the object's property name. Any suggestions would be greatly appreciated.
-Jeremy
-----------------------------------------
maxFields = rs_MetaData.Fields.Count
For i = 0 To maxFields - 1
'Dynamically reference m_objMetaData properties using the name of each field in the rs_MetaData recordset
m_objMetaData.[rs_MetaData.Fields(i).Name] = rs_MetaData.Fields(i).Value
Next
------------------------------------------
The problem is "m_objMetaData.[rs_MetaData.Fields(i).Name]". I don't know the correct syntax for dynamically referencing the object's property name. Any suggestions would be greatly appreciated.
-Jeremy