title: joining 3 tables using month and year criteria
body: <p>I wanted to join three tables.</p>
  
  <p>There are two conditions for joining the tables,[project number] and [current month]-a date field.By specifying the month and year together with the project number i want to get the result.</p>
  
  <p>I used this code but when it gets to the second join statement it raises an error->Syntax error (missing operator) in query expression ''.</p>
  
  <p>I omitted the second join statement to test the first join but the result i get is 4x the actual record.If i have like 4 record in each table to be joined i get 64 records.</p>
  
  <p>Any modifications on my code will be really appreciated.Also I'm using temporary table.</p>
  
  <pre><code>     INSERT INTO patempTable 
                 SELECT 
                        pr.[project number], 
                        pr.[employee number], 
                        pr.[current month], 
                        pr.[net pay], 
                        al.[net allowance], 
                        pd.[net] 
                 FROM 
                        [pay_roll] pr 
                 INNER JOIN [allowance] al ON pr.[project number] = al.[project number]
                       AND MONTH(pr.[current month])=MONTH(al.[current month]) 
                       AND YEAR(pr.[current month])=YEAR(al.[current month]) 
                 JOIN [per_diem_accomodation] pd ON pr.[project number]=pd.[project number] 
                      AND MONTH(pr.[current month])= MONTH(pd.[current month])
                      AND YEAR(pr.[current month])=YEAR(pd.[current month]) 
                 WHERE 
                      pr.[project number]='" &amp; projcode &amp; "' AND 
                      MONTH(pr.[current month])=" &amp; monthnumber &amp; " AND  
                      YEAR(pr.[current month])=" &amp; period 
  </code></pre>