INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Month number must be between 1 and 12

Month number must be between 1 and 12

(OP)
Using Crystal CR Developer version 14.0.4.738 and a MS SQL database

Was using this formula in Crystal version 7.0 without any issues but in version 14 it throws the error "Month number must be between 1 and 12".

The formula is: {@DateClosed} in Date (Year (CurrentDate),Month (CurrentDate)-1 , 16) to Date (Year (CurrentDate),Month (CurrentDate) ,1 )-1

When checking the formula it is highlighting this part "Date (Year (CurrentDate),Month (CurrentDate)-1 , 16)"

I suspect the issue is with "Month (CurrentDate)-1" since this is month 1 when it subtracts 1 it leaves 0.

Apparently Crystal 7 was smart enough to know this is a date and when you are in month 1 that subtracting 1 is 12 not 0.

Is there another data function I should be using that know when in month 1 subtracting 1 is 12 not 0?

Thanks Bennie

RE: Month number must be between 1 and 12

Sounds like you need use the datediff or dateadd functions. They handle the month change nicely. I am not sure what you are trying to accomplish with your formula.

RE: Month number must be between 1 and 12

Replace Date with Dateserial.

-LB

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close