Simple query not working

G

Guest

I have a simple query as follows

SELECT * FROM [tbl_History] WHERE [HistReceiptDate] = 02/10/200

where [HistReceiptDate] is a date field of format "mm/dd/yyyy

This query will not find any records even though records with this date definitely exist in the table

Why does this query not work

ctda
 
D

Duane Hookom

Try:
SELECT * FROM [tbl_History] WHERE [HistReceiptDate] = #02/10/2004#
Keep in mind that this is Feb 10th, not Oct 2nd.
 
G

Guest

Thanks. That did it. I'm obviously a novice with SQL query statements
ctda

----- Duane Hookom wrote: ----

Try
SELECT * FROM [tbl_History] WHERE [HistReceiptDate] = #02/10/2004
Keep in mind that this is Feb 10th, not Oct 2nd

--
Duane Hooko
MS Access MV

ctdak said:
I have a simple query as follows
SELECT * FROM [tbl_History] WHERE [HistReceiptDate] = 02/10/200
where [HistReceiptDate] is a date field of format "mm/dd/yyyy
This query will not find any records even though records with this dat definitely exist in the table
Why does this query not work
ctda
 
J

John Vinson

I have a simple query as follows:

SELECT * FROM [tbl_History] WHERE [HistReceiptDate] = 02/10/2004

where [HistReceiptDate] is a date field of format "mm/dd/yyyy"

This query will not find any records even though records with this date definitely exist in the table.

Why does this query not work?

ctdak

Because it's treating 2/10/2004 as an arithmetic expression giving
..0000998 as the answer (which will match a date/time of 12:00:08am on
December 30, 1899).

If you want it to be treated as a Date, use # as a delimiter:

SELECT * FROM [tbl_History] WHERE [HistReceiptDate] = #02/10/2004#;
 

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