title: Loop through fields of recordset to populate form?
body: <p>I'm trying to use a For loop to loop through the fields in a single record recordset to populate the fields on a form. I was hoping to find a way that is neater/reusable than typing out half a dozen lines of txtField.value = rs!Field.</p>
  
  <p>When I look at the code during runtime both variables have the correct information in them, it just isn't displaying them on the form. Any help would be greatly appreciated. </p>
  
  <pre><code>Dim strClient As String
  Dim rsClient As dao.Recordset
  Dim tfield As String
  Dim ffiend As String
  Dim fld As dao.Field
  
  Set dbs_Current = CurrentDb()
  
  strClient = "Select * from tblClient where pk_client_id = " &amp; gbl_Client_ID
  
  Set rsClient = dbs_Current.OpenRecordset(strClient)
  
  For Each fld In rsClient.Fields
      On Error Resume Next
      tfield = "txt" &amp; fld.Name &amp; ".value"
      ffield = "rsClient!" &amp; fld.Name
      tfield = ffield
  
  Next fld
  </code></pre>