title: Access VBA - How would I have a loop in VBA that allows me to loop through control names
body: <p>I have about 10 text boxes on a form that are actually used for display not entry. They are are named <code>txt_001_Name</code>, <code>txt_002_Title</code>, etc..what kind of loop is used for this.</p>
  
  <p>What kind of VBA should I use to actually loop through the names of the text boxes? So if I was to debug.print it would look like:</p>
  
  <pre><code>txt_001_Title
  txt_002_Title
  txt_003_Title
  </code></pre>
  
  <p>This is probably pretty simple to do - all the more reason that I should learn how!</p>
  
  <p>EDIT: Sorry, I should have been more descriptive about this.</p>
  
  <p>Because of the above naming convention, I am looking to iterate through these text boxes so that I can perform something with each. What each of these 10 text boxes actually represent is numeric values, each having a SQL statement behind them in the form's <code>onload</code> event. I also have another set of ten that hold numeric values that are much more static, and finally another ten that use an expression to simply divide each of the first ten, against the relative "second" ten, and the value ends up in the relative 3. So basically it ends up looking like a dashboard table.</p>
  
  <pre><code>'first ten'       'second ten'     'resulting ten'
  ---------------------------------------------------
  txt_001_value      txt_001_calc     txt_001_result
  txt_002_value      txt_002_calc     txt_002_result
  </code></pre>
  
  <p>etc.</p>
  
  <p>So I actually want to use this for the 'resulting' text boxes. I want to loop through the first ten and perform this easy calculation:</p>
  
  <pre><code> me.txt_001_result = me.txt_001_value / me.txt_001_calc     
  </code></pre>
  
  <p>All the naming conventions "match up", so I can manually type out the 10 lines of the above for this, but I am sure there is a better way (loop through this), and I should probably learn it.</p>