tags:

views:

16

answers:

1

I'm trying to use the below code to bring back all records that are not older than 90 days from a table

Set PlatinumList = db.OpenRecordset("SELECT FORMATTED_CTN FROM CTN_LIST WHERE ((Status='Available') AND (Category='Platinum')) AND (In_Offer_List = True) AND (DATEDIFF(day, Created_DT, current_date()< 90);", dbOpenSnapshot, dbReadOnly)

I keep getting a 'syntax error in query expression' error when I try and run the code

I think I'm formatting the date section of the code incorrectly

+1  A: 

The date token for day is "d" rather than day and your missing a closing )

.. AND (DATEDIFF("d", Created_DT, current_date()) < 90);"

(You also need current_date() as a vba func)

Alex K.