title: Access 2016 VBA: How can I use a control name in a formula?
body: <p>In my Access 2016 report I have 10 controls named txt1 to txt10 and I want to populate them from records in a table.  Is there any way to increment the control name in my loop based on my counter?</p>
  
  <p>Something like this.  Obviously Me.txt(counter) is not an array but the best representation I can give for what I want to do.  </p>
  
  <pre><code>Dim db As DAO.Database
  Dim rs As DAO.Recordset
  Dim counter as integer
  
  Set db=CurrentDatabase
  Set rs=db.OpenRecordSet("SELECT * FROM table WHERE variable = " &amp; something)
  
  If Not rs.EOF Then
      rs.MoveFirst
      counter = 1
      Do Until rs.EOF
          Me.txt(counter) = rs.Fields("field1")
          counter = counter + 1
          rs.MoveNext
      Loop
  End If
  </code></pre>
  
  <p>Thanks!</p>