title: select data from more than 1 table
body: <p>I am using access as my db and am having trouble trying to get my query to select the correct data. At the moment my query seems to be returning all records in the tables when really for this particular value in the WHERE clause, it should be returning only 1.</p>
  
  <p>The idea is to use the 'Requests Boxes' table based on the value in the WHERE clause and use those value to pull data from the 'Boxes' table. I would be grateful if someone could point out my newbie error. I would like to add that I inherited this db and have no option to change it. Many thanks</p>
  
  <p>My db setup is as follows.</p>
  
  <p><strong>Requests Boxes</strong></p>
  
  <p>Request no</p>
  
  <p>Box</p>
  
  <p><strong>Boxes</strong></p>
  
  <p>Box</p>
  
  <p>CustRef</p>
  
  <pre><code>sql = "SELECT [Request Boxes].[Request no], [Request Boxes].Box, Boxes.Box, Boxes.CustRef " &amp;
                    "FROM [Request Boxes], Boxes WHERE [Request Boxes].[Request no] = '" &amp; item &amp; "'"
  </code></pre>
  
  <p><strong>UPDATED CODE:</strong></p>
  
  <pre><code>sql = "SELECT [Request Boxes].[Request no], [Request Boxes].Box, Boxes.Box, Boxes.CustRef " &amp;
                    "FROM [Request Boxes] INNER JOIN Boxes ON [Request Boxes].Box = Boxes.Box " &amp;
                    "WHERE ((([Request Boxes].[Request no]) = '" &amp; item &amp; "' )" &amp;
                    "AND ([Request Boxes].[Customer] = '" &amp; customer2 &amp; "') AND (Boxes.Status = '" &amp; status &amp; "'))"
  </code></pre>