Search code examples
ms-accessms-access-2016

Can't get the Today() function to work properly in MS Access 2016 Custom Web App


I'm trying to setup a query that will show me all of the records in a particular table where the listed expiry date is either in the past or upcoming in the next 6 months (approximately).

At the moment, I have the "Expiry" field added to my query and the 'Criteria' as .

When I try to save the query, I get the following message:

Access can't evaluate an expression or convert data because data types aren't compatible with each other.

TECHNICAL DETAILS

Correlation ID: ae68949d-3041-3000-0984-71635f8fd670

Date and Time: 7/28/2016 6:54:34 PM

I've tried searching the web for a solution, but most websites refer to the Date() function that doesn't seem to be available in the Access 2016 Custom Web App. When I take out the "+180", it works fine but obviously doesn't give me what I need.

Any help would be appreciated.

=============================

UPDATE: Some users have asked for my SQL and Table Design details. I don't seem to have any way of accessing the SQL View (the option doesn't appear), but here's a copy of my table view: Access Query Table Design

In the table, 'Active' is a Yes/No field and 'Expiry' is Date/Time.


Solution

  • Try

    < DateAdd(Day, 180, Today())
    

    as criteria.

    According to https://msdn.microsoft.com/en-us/library/office/jj249452.aspx this should work in a custom web app.