title: How do I use a record in a Query that is not the RecordSource in conditional statements?
body: <p>First off, I am relatively new to <code>Access</code> and <code>VBA</code>, and while I have some good understanding of things I'm still not too familiar with the underlying concepts that access and <code>VBA</code> use. </p>
  
  <p>I have two queries, Tuning and Hardware (the database is for a CNC machining line). Tuning is the Record Source for the form. I use data in the Tuning query in conditional statements to colour code boxes on the form depending on their values. A sample of this is in my code is:</p>
  
  <pre><code>If MachineID = 3 And (Integral_Gain_X &lt; 181 Or Integral_Gain_Y &lt; 181 Or 
  Integral_Gain_Z &lt; 195) Then
  m110a.BackColor = RGB(247, 255, 0)
  End If
  </code></pre>
  
  <p>(<code>Integral_Gain_X</code> is a field in Tuning)</p>
  
  <p>I want to have a similar type of statement that uses data entries from a field in the Hardware query to make similar types of conditional statements, but have been not been able to do so. Is it possible, and if so could you explain the best way to go about setting this up?</p>
  
  <p>Please let me know if this is enough information, it is my first post on here.</p>
  
  <p>Thanks a lot in advance!</p>