Query on a date (1 Viewer)

KEKeogh

Registered User.
Local time
Yesterday, 22:32
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: 84

plog

Banishment Pending
Local time
Yesterday, 21:32
Joined
May 11, 2011
Messages
11,669
In Design view make a calculated field like so:

DateCriteria: DateValue([YourDateFieldHere])

Then in the criteria section put this:

[Enter Date]
 

KEKeogh

Registered User.
Local time
Yesterday, 22:32
Joined
May 4, 2011
Messages
80
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."
 

plog

Banishment Pending
Local time
Yesterday, 21:32
Joined
May 11, 2011
Messages
11,669
Can you post your database? Or at least the SQL?
 

KEKeogh

Registered User.
Local time
Yesterday, 22:32
Joined
May 4, 2011
Messages
80
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]));
 

plog

Banishment Pending
Local time
Yesterday, 21:32
Joined
May 11, 2011
Messages
11,669
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

Top Bottom