title: MSAccess - populate text box with value from query
body: <p>I have a combo box and several text boxes on a form. When I select a value from the combo box I want it to run a query based on that value and populate the text boxes with the data returned by the query. The query should only return one record and the textboxes correnspond to different columns in that record.</p>
  
  <p>I have this code:</p>
  
  <pre><code>Private Sub cbo_equip_loc_Change()
  Dim location As String
  Me.cbo_equip_loc.SetFocus
  location = DLookup("NAME", "Query1", "position = '" &amp; Me.cbo_equip_loc.SelText &amp; "'")
  Me.Text51.SetFocus
  Me.Text51.Text = location
  
  End Sub
  </code></pre>
  
  <p>But I get this error: "This property is read-only and can't be set"</p>
  
  <p>Any ideas?</p>
  
  <p>Solved: Im an idiot. </p>
  
  <p>I had some value in the Control Source from something I was trying to do before. Removed that and it worked!</p>