Trouble with Criteria in query

  • Thread starter Thread starter Lurch
  • Start date Start date
L

Lurch

Hey guys!

I have a query that has a field in a table called "Year". It contains just
the year and has several years going back to the mid 90's.

How do I put a criteria in the query that will filter out everything but the
current year regardless of what year it is. I tried to use the DateSerial
but to no avail.

Any help would be most appreciated. I know this is probably simple but I
just can't seem to get it.

Thanks everyone!!

Tony
 
Try this as the criterion for your Year field:
Year(Date())

Note that it's not a good practice to use Year, Month, Name, Date, Time,
etc. as names of fields -- these are reserved words in ACCESS because they
are the names of VBA functions or common methods/properties of objects.
ACCESS can become very confused if you're not careful to always enclose the
Year field name in [ ].
 
Hey guys!

I have a query that has a field in a table called "Year". It contains just
the year and has several years going back to the mid 90's.

How do I put a criteria in the query that will filter out everything but the
current year regardless of what year it is. I tried to use the DateSerial
but to no avail.

Any help would be most appreciated. I know this is probably simple but I
just can't seem to get it.

Thanks everyone!!

Tony

If you really do have a field named "Year", I would suggest you read
the appropriate Microsoft KnowledgeBase article for your version of
Access.

109312 'Reserved Words in Microsoft Access'
209187 'Acc2000: 'Reserved Words in Microsoft Access'
286335 'ACC2002: Reserved Words in Microsoft Access'
 
Back
Top