Query on a date

KEKeogh

Registered User.
Local time
Yesterday, 20:36
Joined
May 4, 2011
Messages
80
OK So I have a Query that returns a date/time result.

I'm sure this is simple and probably asked before but I cannot find or think of the solution.

See the attached image

What I want is the criteria for the query to prompt for the date and when the user only types in "12/17/2015" it returns all records for that date regardless of the time.

Thanks
Kathie
 

Attachments

  • Capture.JPG
    Capture.JPG
    31.1 KB · Views: 113
In Design view make a calculated field like so:

DateCriteria: DateValue([YourDateFieldHere])

Then in the criteria section put this:

[Enter Date]
 
Doesn't seem to work.

Keep getting the errors

"Data type mismatch in criteria expression"

or

"This expression is typed incorrectly, or it is too complex to be evaluated. For example, a numeric expression may contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables."
 
Can you post your database? Or at least the SQL?
 
The Query's SQL is:

SELECT Client_Contact_Info_Alternate.DateUpdated, "Contact" AS Expr1, DateValue([DateUpdated]) AS DateCriteria
FROM Client_Contact_Info_Alternate
WHERE (((DateValue([DateUpdated]))=[Enter Date]));
 
Sounds like you have Null values in DateUpdated.

I think this will work if you first build another query to exclude nulls. Like so:

Code:
SELECT Client_Contact_Info_Alternate.DateUpdated, "Contact" AS Expr1 
FROM Client_Contact_Info_Alternate
WHERE DateUpdate Is Not Null;

You would save that naming it like 'QueryName'. Then you would use the query you have but replace the table name with 'QueryName':

Code:
SELECT DateUpdated, Expr1 
FROM QueryName
WHERE DateValue([DateUpdated])=[Enter Date];
 

Users who are viewing this thread

Back
Top Bottom