title: MS Access Using a nested select within a switch for my query
body: <p>I am using a nested Select within my Switch query and cannot seem to find the error hoping someone can spot it for me.  </p>
  
  <pre><code>SELECT tblTaxiInvoices.TaxiInvID, tblTaxiInvoices.TaxiInvNo, tblChitRegister.pkchitnumber, tblClientRegister.fkTMS_Number, tblFunds.fund, tblFundCentres.fundcentre, tblCostCentres.costcentre, tblGLAccounts.glaccount, tblClientRegister.IO_id,     tblClientRegister.WBS_id, tblClientRegister.commit_code, tblChitRegister.faceamount, tblChitRegister.adminfee
  
  , [faceamount]*0.884956 AS facenetofGST
  
  ,Switch
   (
   (Select HSTFactor From tblProvincialTaxes where tblTaxiInvoices.TaxiInvDateClosed &gt;= CreatedDate and PID = 6 and active = 'yes') as TestfacenetofGST, ( [faceamount]* TestfacenetofGST )  ,
  
   (Select HSTFactor From tblProvincialTaxes where tblTaxiInvoices.TaxiInvDateClosed &lt;= CreatedDate and PID = 6 and active = 'No') as TestfacenetofGST, ( [faceamount]* TestfacenetofGST ),0
   ) as xxx
  
  , [facenetofGST]+[adminfee] AS TtlToClient
  
  , tblTaxiCos.taxico, tblTaxiCos.prov, tblTaxiInvoices.Closed, tblTaxiInvoices.TaxiInvDateClosed
  , (Select HSTFactor From tblProvincialTaxes where tblTaxiInvoices.TaxiInvDateClosed &gt; CreatedDate and PID = 6 and active = 'yes') as test
  
  FROM (tblTaxiCos INNER JOIN tblTaxiInvoices ON tblTaxiCos.pktaxico_id = tblTaxiInvoices.TaxiCoID) INNER JOIN (tblGLAccounts INNER JOIN (tblFunds INNER JOIN (tblFundCentres INNER JOIN (tblCostCentres INNER JOIN (tblClientRegister INNER JOIN     tblChitRegister ON tblClientRegister.pkclient_id = tblChitRegister.fkclient_id) ON tblCostCentres.pkcostcentre_id = tblClientRegister.fkcostcentre_id) ON tblFundCentres.pkfundcentre_id = tblClientRegister.fkfundcentre_id) ON tblFunds.pkfund    _id =     tblClientRegister.fkfund_id) ON tblGLAccounts.pkglaccount_id = tblClientRegister.fkglaccount_id) ON tblTaxiInvoices.TaxiInvID = tblChitRegister.taxiinv_ID
  WHERE (((tblTaxiCos.prov)="ON"))
  </code></pre>