Friday, March 30, 2012

If in current month

I need to do this but can't find the syntax:

IIf(Fields!EnteredDate.Value is in current month , Cint(Fields!PC.Value), CInt(0))

I think theres a month, day and date function that you can use for this.|||

Failing that something like:

IIF(DateAdd("m",0,Fields!EnteredDate.Value) = DateAdd("m",0,now()), Cint(Fields!PC.Value), CInt(0))

DateAdd(<level to extract>, <Point in time>, <set>)

I'm not sure about the current date function. Isn't there a Global parameter which gets the system current date!?

|||

=iif(Month(Fields!EnteredDate.Value) = Month(Today), CInt(Fields!PC.Value), CInt(0))

See also: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vafctmonth.asp

Similar to the Month() function, there are also other functions available in the VB Runtime Library - such as Year(), Day(), etc.

-- Robert

|||How can I restrict dates that are in this month and year. For example if today is 2/20/2006, I do not want that EnteredDate included. 2/20/2005 is acceptable though...|||

solved my second question:

=IIF(Month(Fields!EnteredDate.Value) & Year(Fields!EnteredDate.Value) <> Month(Today) & Year(Today),Cint(Fields!PDC.Value),0)

No comments:

Post a Comment