title: Can you use a variable for the Field name when using AddNew to a record set?
body: <p>I'm using a DAO recordset to update a table because of problems enocuntered <a href="https://stackoverflow.com/questions/21758073/when-inserting-data-from-a-query-to-a-table-does-the-query-run-for-each-record">here</a>.</p>
  
  <p>This works fine when I know the name of the field I'm updating, e.g.:</p>
  
  <pre><code>rs2.AddNew
  rs2![ContactID] = rs.Fields(0).Value
  rs2![Fee Protection Insurance] = "" &amp; strValue &amp; ""
  rs2.Update
  </code></pre>
  
  <p>works perfectly.</p>
  
  <p>However, the field that I'm trying to update won't always have the same name, so I attempted to use a variable here too, expecting it to evaluate and be equivilent to the above code:</p>
  
  <pre><code>rs2.AddNew
  rs2![ContactID] = rs.Fields(0).Value
  rs2!["strFieldName"] = "" &amp; strValue &amp; ""
  rs2.Update
  </code></pre>
  
  <p>but it tells me that item's not in the collection, even when strFieldName is set to Fee Protection Insurance.</p>
  
  <p>I've tried this various ways, including:</p>
  
  <pre><code>rs2![" &amp; strFieldName &amp; "] = "" &amp; strValue &amp; ""
  
  rs2![strFieldName] = "" &amp; strValue &amp; ""
  
  rs2!["" &amp; strFieldName &amp; ""] = "" &amp; strValue &amp; ""
  
  rs2![cStr(strFieldName)] = "" &amp; strValue &amp; ""
  </code></pre>
  
  <p>none of which work.</p>
  
  <p>Am I going about this the wrong way, or am I attempting something impossible?</p>