|
-
Mar 22nd, 2006, 01:47 PM
#1
Thread Starter
New Member
Crystal Report Date Comparison
I have a crystal report that has a field showing a date, but it comes in as a text field. I need to compare this field to the current date, so that the report will only display records where the date's field is within the current month. Is there a way to do reference modification, where I can start with the first character in the field, and take, say 2 characters? Or is there another way to do this?
Any help and ideas will be greatly appreciated.
Thanks in advance,
Jessica
-
Mar 22nd, 2006, 03:43 PM
#2
Re: Crystal Report Date Comparison
Add something like the following to the Record Selection Formula
ToNumber(Mid ({Name of your date field},2,2)) = Month(CurrentDate)
Change the 2,2 as required.
-
Mar 22nd, 2006, 05:06 PM
#3
Thread Starter
New Member
Re: Crystal Report Date Comparison
Thank you so much for replying. I couldn't get your suggestion to work, but after playing around with it for awhile, I got it to work.
Code that worked:
Month (CDate ({my date field})) = Month (CurrentDate)
Again, thank you.
Jessica
-
Mar 22nd, 2006, 05:22 PM
#4
Re: Crystal Report Date Comparison
Note that your code may not work on all computers. CDate uses the computers Regional Setting when converting date strings to date fields.
So, Month (CDate ({"01/02/2005"})) Could return 1 or 2, again depending on the regional setting.
In what format do you store the date strings?
-
Mar 22nd, 2006, 06:12 PM
#5
Thread Starter
New Member
Re: Crystal Report Date Comparison
The format that is being used: mm/dd/yyyy.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|