Parameter Criteria

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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]
 
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
 
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

Between Date 10
Date criteria 4
criteria 3
Access Dcount (multiple criteria) 3
Parameter query issue in Access 2003 6
Query to display the difference of period for an employee. 1
sorting by dates -- parameters? 1
Criteria 3

Back
Top