Problem with using query criteria

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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)
 
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
..
 
Back
Top