MS Database ????????

pea33nut

Member
Dec 25, 2004
61
0
0
I need to set up my query so it finds a range of dates. I need all 2004 records. The field that the date is in is in this format 01/01/04. I tried something like this but it doesn't works

where date > 12/30/03 and date < 01/01/05

Can someone help me out
Thank you
 

MrChad

Lifer
Aug 22, 2001
13,507
3
81
If it's Access, you'll want:

WHERE date > #12/30/03# AND date < #01/01/05#

If it's SQL Server, use single quotes:

WHERE date > '12/30/03' AND date < '01/01/05'
-or-
WHERE date BETWEEN '01/01/04' AND '12/31/04'
 

pea33nut

Member
Dec 25, 2004
61
0
0
That didn't seem to work. I get no data returned and when I check out the query in design view half of the code that I wrote is transfered to the next field (which is empty).

 

MrChad

Lifer
Aug 22, 2001
13,507
3
81
Is your column name actually "date"? That could be a problem (date is a keyword and should not be used as a column name).
 

bunker

Lifer
Apr 23, 2001
10,572
0
71
This should also work in Access

WHERE DatePart("yyyy", [DateColumnName]) = 2004

That's assuming the date column is set up as a date data type.