Microsoft Access Query: Use a field value as year

5 pts.
Tags:
Access 2003 date query
Microsoft Access
I work with MS Access 2003. I have a query with parameter to show all contracts in place of a single year, specified by the parameter. The name of this column with the years, i called "Contract Year". I wish to add a criteria that then shows cancelled contracts at the end of that specific year. I tried the following as criteria for the Column "Cancelled": #31/12/[Contract Year]# to try and have it take the year mentioned in that field. But it doesn't work. I tried adding LIKE to it and the &-sign, still no luck. Is it possible to use a filed name in a date criteria and if so, how could i do it? I am not yet familiar with VBA or macro's, though i am eager to learn about this. Thank you very much in advance for your help.

Software/Hardware used:
MS Access 2003

Answer Wiki

Thanks. We'll let you know when a new response is added.

You could use the <a href=”http://www.techonthenet.com/access/functions/date/dateserial.php”>DateSerial function</a>.

Something like this:

<pre>DateSerial([Contract Year],12,31)</pre>

-CarlosDL

Another way:

CDate(”12/31/” & [contract year])

-Msi77

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • msi77
    Another way:
    CDate("12/31/" & [contract year])
    1,660 pointsBadges:
    report
  • SRoman1234
    Eveline, I am looking for a basic Contract Management database using MS Access. Can you please share with me what you have (structure & queries)? Thank you, Steve
    10 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following