Sevn
I trust ME!
- Local time
- Today, 17:27
- Joined
- Mar 13, 2008
- Messages
- 97
I've been trying to get this to work, and I'm beginning to think it's impossible.
Can anyone tell me why I continue to get: Syntax Error (missing Operator) for this statement? I've checked all field/object names, and nothings mispelled.
Am I not suppose to put all these IIf statements? I'm know I could just create a query with all the formulas, and retrieve the results. Although; for job security purposes, I'd like to do all the calculations in the code.
Can anyone tell me why I continue to get: Syntax Error (missing Operator) for this statement? I've checked all field/object names, and nothings mispelled.

Am I not suppose to put all these IIf statements? I'm know I could just create a query with all the formulas, and retrieve the results. Although; for job security purposes, I'd like to do all the calculations in the code.
Code:
Set Rs = CurrentDb.OpenRecordset("SELECT sltQryItemDetail.PID, IIf([Forms]![frmDataColl]![cboFHC1]='D*' And [Forms]![frmDataColl]![txtFrtRtCWT1]=0,'Frt Rate',[NPrice]-[SCost]) AS Margin," & _
"IIf([Forms]![frmDataColl]![cboFHC1]='D*' And [Forms]![frmDataColl]![txtFrtRtCWT1]=0,'Frt Rate',[Margin]/[NPrice]) AS MarginPct," & _
"IIf([Forms]![frmDataColl]![txtPrice1]<>0,[Forms]![frmDataColl]![txtPrice1]*([Forms]![frmDataColl]![txtAnnlTons1]*[UnitTnTm]),0) AS GRevImp," & _
"IIf([Forms]![frmDataColl]![txtPrice1]=0,0,[Forms]![frmDataColl]![txtPrice1]-([TotWhse]+[UFrt])) AS NPrice," & _
"IIf([Forms]![frmDataColl]![txtFrtRtCWT1]=0,0,IIf([Forms]![frmDataColl]![cboFHC1]='D*',[UnitTnTm]*[Forms]![frmDataColl]![txtFrtRtCWT1],0)) AS UFrt," & _
"IIf([Forms]![frmDataColl]![txtCustCountry]='US' And [Country]='CA',[TotalCost]*[Forms]![frmDataColl]![txtXrate]," & _
"IIf([Forms]![frmDataColl]![txtCustCountry]='CA' And [Country]='US',[TotalCost]*(1/[Forms]![frmDataColl]![txtXrate]),[TotalCost]*1)) AS TCost," & _
"IIf([Forms]![frmDataColl]![txtCustCountry]='US' And [Country]='CA',[TotWhse]*[Forms]![frmDataColl]![txtXrate]," & _
"IIf([Forms]![frmDataColl]![txtCustCountry]='CA' And [Country]='US',[TotWhse]*(1/[Forms]![frmDataColl]![txtXrate]),[TotWhse]*1)) AS TWhse," & _
"[TCost]-[TWhse] AS SCost, sltQryItemDetail.UnitTnTm, sltQryItemDetail.UnitShipWgt, [NPrice]*([Forms]![frmDataColl]![txtAnnlTons1]*[UnitTnTm]) AS TNSales," & _
"[Margin]*([Forms]![frmDataColl]![txtAnnlTons1]*[UnitTnTm]) AS TGMargin, sltQryItemDetail.Country, sltQryItemDetail.TotWhse, sltQryItemDetail.TotalCost" & _
"FROM sltQryItemDetail;")