title: MS Access: How to load data from query into form
body: <p>I have a form that helps the user add some data into a Database, however I noticed that a few of the fields on each product added are very similar. So I'm adding a second database of commonly used fields that can be pre-filled by selecting from a combo-box.<br>
  For example if the user is adding Product XX-X but product XX-X is of the same family of YY-Y and I already have YY-Y's data in Database2, I want to just load those parameters. I made a query that returns the parameters as I want however I dont know how to add this to the FORM.<br>
  Basically I have a blank VBA code slot for "ComboBox_Change".<br>
  I want the ComboBox_Change function to load field X from query and paste it into field X1 on the current form.
  Hope I'm explaining myself correctly.<br>
  Thanks!  </p>
  
  <p><em>THANKS for the suggestion</em> this is the code so far that has an error</p>
  
  <pre><code>Private Sub LoadMatCB_Change()
  Dim rs As Recordset
  Dim db As Database
  
  Set db = CurrentDb
  
  Set rs = CurrentDb.OpenRecordset("VendorDeetsQuery")
  
  If Nz(Me.Input_Vendor.Value, "") = "" Then Me.Input_Vendor.Value = rs![Origin]
  
  Set rs = Nothing
  Set db = Nothing
  
  End Sub
  </code></pre>