Syntax error: missing operator

G

Guest

That is the error I'm getting for my anniversary dates query. The SQL:

SELECT LastName, FirstName, HireDate, IIF(DateSerial(Year(Date() + 1,
Month(HireDate), Day(HireDate)) < Date() + 365, Year(Date() + 365) –
Year(HireDate), Year(Date()) – Year(HireDate))
AS YearsOfService
FROM tblEmployees
WHERE (DateSerial(Year(Date()), Month(HireDate), Day(HireDate))
BETWEEN Date() AND Date()) + 365 OR (DateSerial(Year(Date()) + 1,
Month(HireDate), Day(HireDate)) <= Date() + 365;

There is a selection area over the first minus sign in the SQL after I close
the error window, if that's helpful.
 
G

Guest

Bah, I should slap myself for not counting up the parentheses myself. Thanks
Roger.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top