Cannot figure out DatePart function

  • Thread starter Thread starter Jack
  • Start date Start date
J

Jack

That's wrong with the following expression Version: 2000 (9.0)

Posted on 01/22/09 01:33 PM
Posted by gamaz - Utter Access Addict
Posts: 193 -

Forum: Access Queries • Edit
• Reply
• Quote
• Quick Reply
• Print this post
• Bookmark Post
• Notify Moderator
• Email Post
• Top of page
Hi,
I am trying to use the following expression in a query. However it is giving
me error:
INVALID PROCEDURE CALL:

Expression:
DatePart("2008",[tblActionRequest]![DateAssigned])

I would appreciate any help to resolve this issue. Thanks
 
Hi Jack

Your "2008" doesn't make sense as this position represents the date-part
interval (year, month day etc.) interval. I assume you're looking to return
the year so try:

DatePart("y", [tblActionRequest]![DateAssigned])

Cheers.

BW
 
Hi BeWyched and Chris,
Thanks for pointing out the mistake here. I went ahead and changed "2008" to
"YYYY" and it worked greate. Thanks.

Chris O'C via AccessMonster.com said:
The first argument in the function (where you put "2008") needs to have an
interval of time as listed in the help. If you want the year change it to
this:

Expression: DatePart("yyyy",[tblActionRequest]![DateAssigned])

Chris

That's wrong with the following expression Version: 2000 (9.0)
I am trying to use the following expression in a query. However it is giving
me error:
INVALID PROCEDURE CALL:

Expression:
DatePart("2008",[tblActionRequest]![DateAssigned])

I would appreciate any help to resolve this issue. Thanks
 
 That's wrong with the following expression  Version: 2000 (9.0)

Posted on 01/22/09 01:33 PM
Posted by gamaz - Utter Access Addict
Posts: 193 -

Forum: Access Queries  • Edit
• Reply
• Quote
• Quick Reply
• Print this post
• Bookmark Post
• Notify Moderator
• Email Post
• Top of page  
Hi,
I am trying to use the following expression in a query. However it is giving
me error:
INVALID PROCEDURE CALL:

Expression:
DatePart("2008",[tblActionRequest]![DateAssigned])

I would appreciate any help to resolve this issue. Thanks  

What is it that you're trying to do? If you want to get the year, use
the year function

YYYY: Year([tblActionRequest]![DateAssigned])
MM: Month([tblActionRequest]![DateAssigned])
DD: Day([tblActionRequest]![DateAssigned])

HTH,
Chris M.
 
Back
Top