Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: YearToLastMonth possible? Post Reply Post New Topic
Author Message
Rick
Newbie
Newbie


Joined: 14 Mar 2007
Online Status: Offline
Posts: 22
Quote Rick Replybullet Topic: YearToLastMonth possible?
    Posted: 17 Apr 2007 at 12:39am
Hi,
 
Is it possible to make a selection which contains all data in the period January 1st - last day of previous month? The standard list of periods doesn't seem to have this option.
 
Thanks!
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 17 Apr 2007 at 9:08am
You have to create a custom date function to handle the last day. This calculates the first day of the current month and then subtracts one day.
DateAdd("d", -1, Date(Year (CurrentDate), Month(CurrentDate), 1)-1)

Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
Rick
Newbie
Newbie


Joined: 14 Mar 2007
Online Status: Offline
Posts: 22
Quote Rick Replybullet Posted: 18 Apr 2007 at 1:50am
Thanks,
 
As I am new in Crystal and programming in general, I am having trouble creating the custom function.
I figured the YearToLastMonth function would not need variables, as CurrentDate is the only relevant date in both January 1st of this year and last day of last month.
Anyway, Crystal asks me for variables and gives me a lot of errors when I am trying to make the function.
 
Any suggestions on how to create it, please? Thanks in advance!!
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.