G
Grimwadec
I wrote this VBA CODE:
Dim strgSQLIsLoaded As String
strgSQLSelect = "SELECT * FROM tblPurchOrders "
strgSQLWhere = "WHERE JobID = " &
([Forms]![frmCustomerG].[subfrmJob].[Form].[JobID]) & " "
strgSQLAnd = "And SuppName = " &
(IIf(([Forms]![frmCustomerG].[subfrmJob].[Form].[PurchType] = "Make"),
([Forms]![frmCustomerG].[subfrmJob].[Form].[MakingSupplier]),
([Forms]![frmCustomerG].[subfrmJob].[Form].[TrimSupplier]))) & " "
strgSQLIsLoaded = strgSQLSelect & strgSQLWhere & strgSQLAnd
From the following ORIGINAL QUERY
SELECT tblPurchOrders.ID, tblPurchOrders.JobID, tblPurchOrders.SuppName,
tblPurchOrders.OrderDate, tblPurchOrders.OrderDetail, tblPurchOrders.OurCo,
tblPurchOrders.OurPersonShortName
FROM tblPurchOrders
WHERE (((tblPurchOrders.JobID)=Forms!frmCustomerG.subfrmJob.Form.JobID) And
((tblPurchOrders.SuppName)=IIf((Forms!frmCustomerG.subfrmJob.Form.PurchType="Make"),(Forms!frmCustomerG.subfrmJob.Form.MakingSupplier),(Forms!frmCustomerG.subfrmJob.Form.TrimSupplier))));
I get Runtime error “Syntax Error (Missing Operator)â€
Please can anyone help me with locating the Syntax error – I guess the IIf
didn’t help
Dim strgSQLIsLoaded As String
strgSQLSelect = "SELECT * FROM tblPurchOrders "
strgSQLWhere = "WHERE JobID = " &
([Forms]![frmCustomerG].[subfrmJob].[Form].[JobID]) & " "
strgSQLAnd = "And SuppName = " &
(IIf(([Forms]![frmCustomerG].[subfrmJob].[Form].[PurchType] = "Make"),
([Forms]![frmCustomerG].[subfrmJob].[Form].[MakingSupplier]),
([Forms]![frmCustomerG].[subfrmJob].[Form].[TrimSupplier]))) & " "
strgSQLIsLoaded = strgSQLSelect & strgSQLWhere & strgSQLAnd
From the following ORIGINAL QUERY
SELECT tblPurchOrders.ID, tblPurchOrders.JobID, tblPurchOrders.SuppName,
tblPurchOrders.OrderDate, tblPurchOrders.OrderDetail, tblPurchOrders.OurCo,
tblPurchOrders.OurPersonShortName
FROM tblPurchOrders
WHERE (((tblPurchOrders.JobID)=Forms!frmCustomerG.subfrmJob.Form.JobID) And
((tblPurchOrders.SuppName)=IIf((Forms!frmCustomerG.subfrmJob.Form.PurchType="Make"),(Forms!frmCustomerG.subfrmJob.Form.MakingSupplier),(Forms!frmCustomerG.subfrmJob.Form.TrimSupplier))));
I get Runtime error “Syntax Error (Missing Operator)â€
Please can anyone help me with locating the Syntax error – I guess the IIf
didn’t help