Parameter Criteria

G

Guest

Hi,
I need criteria to run a query to pick up only the last four numbers of the
year please.

Ex: I entered 05/08/2007, 06/07/2007 and so on..... in my DATE field. Is
there a way to create a parameter query that only need to enter the year,
like 2007 instead of 05/08/2007?

Thanks
Chi Huynh
 
F

fredg

Hi,
I need criteria to run a query to pick up only the last four numbers of the
year please.

Ex: I entered 05/08/2007, 06/07/2007 and so on..... in my DATE field. Is
there a way to create a parameter query that only need to enter the year,
like 2007 instead of 05/08/2007?

Thanks
Chi Huynh

If the DateField datatype is Date/Time then add a new column to the
query grid.

ForYear:Year([DateField])

As criteria on this column, write:
[Enter the year]
 
G

Guest

Chi,

Your query would look something like:

Select Field1, Field2, DateField
FROM youtTable
WHERE Year(DateField) = [What year]

You can actually define the [What year] parameter by right clicking in the
grey portion of the query grid, and selecting parameters. Enter "What year"
as the parameter and Integer as the data type.

HTH
Dale
 
J

Jeff Boyce

The "how to" responses you've received offer a solution.

Please be aware that if your field is named "DATE", you will confuse both
Access and yourself -- this word is a "reserved word" in Access, so Access
will interpret seeing it as whatever IT thinks it means. If you are using
"Date" as the fieldname, consider changing the fieldname.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 

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

Similar Threads


Top