G
Guest
Can anyone tell me what is wrong with the following? I copied the code in
quotes from the SQL view of a MS Access query design and I keep getting a
syntax error. Thank you for your consideration.
George
Dim mySQL As String
mySQL = "UPDATE tblLots RIGHT JOIN tblDuesPayments" & _
"ON tblLots.ACCTNBR = tblDuesPayments.AcctNbr" & _
"SET tblLots.ThisYrPaid =
Nz(tblLots.ThisYrPaid)+Nz(tblDuesPayments.CurrentYearDuesPd)," & _
"tblLots.LastPmtDate =
IIf(tblDuesPayments.PmtDate>Nz(tblLots.LastPmtDate)," & _
"tblDuesPayments.TotalsUpdated = True" & _
"WHERE (((tblDuesPayments.TotalsUpdated)=False)" & _
"AND
(([tblDuesPayments]![CurrentYearDuesPd]+[tblDuesPayments]![LastYearDuesPd]+"
& _
"[tblDuesPayments]![PriorYearsDuesPaid]+[tblDuesPayments]![LateFeePd]+"
& _
"[tblDuesPayments]![CollCostsPd]+[tblDuesPayments]![AssessmentPd]+[tblDuesPayments]![AttyFeePd])<>0));"
DoCmd.RunSQL mySQL
quotes from the SQL view of a MS Access query design and I keep getting a
syntax error. Thank you for your consideration.
George
Dim mySQL As String
mySQL = "UPDATE tblLots RIGHT JOIN tblDuesPayments" & _
"ON tblLots.ACCTNBR = tblDuesPayments.AcctNbr" & _
"SET tblLots.ThisYrPaid =
Nz(tblLots.ThisYrPaid)+Nz(tblDuesPayments.CurrentYearDuesPd)," & _
"tblLots.LastPmtDate =
IIf(tblDuesPayments.PmtDate>Nz(tblLots.LastPmtDate)," & _
"tblDuesPayments.TotalsUpdated = True" & _
"WHERE (((tblDuesPayments.TotalsUpdated)=False)" & _
"AND
(([tblDuesPayments]![CurrentYearDuesPd]+[tblDuesPayments]![LastYearDuesPd]+"
& _
"[tblDuesPayments]![PriorYearsDuesPaid]+[tblDuesPayments]![LateFeePd]+"
& _
"[tblDuesPayments]![CollCostsPd]+[tblDuesPayments]![AssessmentPd]+[tblDuesPayments]![AttyFeePd])<>0));"
DoCmd.RunSQL mySQL