I copied this syntax fro a query:
' Build SQL string
strSQL = "SELECT tblCustomer.CustID, tblCustomer.Customer, tblCustomer.AccNo, tblCustomer.Depot," & _
"tblCustomer.Notes, tblFlt.FlNo, tblFlt.Desc, tblData.DateFit, tblData.DateRem," & _
"tblData.HoursFit, tblData.HoursRem, nz([HoursRem]-[HoursFit]) AS Hours," & _
"tblData.Tyre, tblData.Qty, tblData.SerCost, tblData.TyreCost," & _
"nz([SerCost]+[TyreCost]) AS TotCost, tblData.Notes, tblData.Completed," & _
"nz(format([TotCost]/[Hours],:###0,0000")) AS CPH"
FROM (tblCustomer INNER JOIN tblFlt ON tblCustomer.CustID = tblFlt.CustID) INNER JOIN tblData ON tblFlt.FlID = tblData.FlID
WHERE (((tblCustomer.AccNo) = [Forms]![frmCustomer]![AccNo]) And ((tblFlt.FlNo) = [Forms]![sfrmFlt]![cboFlt]) And ((tblData.Completed) = Yes))
and the VBA compiler throws a fluffy on the Inner Join in the FROM string.
Can some one please help with this.
The compiler does not like this string as well:
"nz(format([TotCost]/[Hours],:###0,0000")) AS CPH"
Any help would be much appreciated.
Hayton McGregor
' Build SQL string
strSQL = "SELECT tblCustomer.CustID, tblCustomer.Customer, tblCustomer.AccNo, tblCustomer.Depot," & _
"tblCustomer.Notes, tblFlt.FlNo, tblFlt.Desc, tblData.DateFit, tblData.DateRem," & _
"tblData.HoursFit, tblData.HoursRem, nz([HoursRem]-[HoursFit]) AS Hours," & _
"tblData.Tyre, tblData.Qty, tblData.SerCost, tblData.TyreCost," & _
"nz([SerCost]+[TyreCost]) AS TotCost, tblData.Notes, tblData.Completed," & _
"nz(format([TotCost]/[Hours],:###0,0000")) AS CPH"
FROM (tblCustomer INNER JOIN tblFlt ON tblCustomer.CustID = tblFlt.CustID) INNER JOIN tblData ON tblFlt.FlID = tblData.FlID
WHERE (((tblCustomer.AccNo) = [Forms]![frmCustomer]![AccNo]) And ((tblFlt.FlNo) = [Forms]![sfrmFlt]![cboFlt]) And ((tblData.Completed) = Yes))
and the VBA compiler throws a fluffy on the Inner Join in the FROM string.
Can some one please help with this.
The compiler does not like this string as well:
"nz(format([TotCost]/[Hours],:###0,0000")) AS CPH"
Any help would be much appreciated.
Hayton McGregor