Query Part of Field

S

Scott

I have a database with a date field. The field is formatted as 2 digit month,
2 digit day and 4 digit year (example: 05/10/2006)

Is there any way to query just the year part of the field?

Thank you!
 
R

Rick B

If it is actually a date field, then the format is not relevant. You can
display a date field in any format you like.

To pull out the year, use the following:

=Year([YourField])


If the field is NOT a date field. If it is a text field, then try this...
=Right([YourField],4)

or

=Right([YourField],2)
 
S

Scott Nash

Thanks..

I tried =Year([myfield]) and it returns no results.

The other suggestions you gave me returned an error regarding diff data
types.

Thanks for your help!
Rick B said:
If it is actually a date field, then the format is not relevant. You can
display a date field in any format you like.

To pull out the year, use the following:

=Year([YourField])


If the field is NOT a date field. If it is a text field, then try this...
=Right([YourField],4)

or

=Right([YourField],2)




--
Rick B



Scott said:
I have a database with a date field. The field is formatted as 2 digit
month,
2 digit day and 4 digit year (example: 05/10/2006)

Is there any way to query just the year part of the field?

Thank you!
 

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