Problem with using query criteria

E

Eric

I have a column named "DATE". The way the information is set up is,
YYYYMMDD. I need to run a query by YYYY. In other words, i need to filter
everything that is in year 2000 but i have information from 1999-2003. How
can i run this query with this criteria.
 
S

Steve

First you need to change the name of the Date field. Date is a reserved word
and should not be used for a field name.

YYYYMMDD is a text format so you can use a text function to get the year.
Add the following expression in a blank field in your query:
MyYear:Left([MyDate],4)
Then put "2000" with the quotes in the criteria of that field.

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
(e-mail address removed)
 
J

John Spencer

What type of field is DATE?

If it is text

Field: [Date]
Criteria: LIKE "2000*"

if it is a Number
Field: [Date]
Criteria: Between 20000101 and 20001231

If it is a datetime field
Field: [Date]
Criteria: Between #2000-01-01# and #2000-12-31#

OR
Field: TheYear: Year([Date])
Criteria: 2000

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 

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