Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DateAdd Formula assistance please 1

Status
Not open for further replies.

markajem

Programmer
Dec 20, 2001
564
US
I am attempting to add units sold to a report for last year. I figured using the DateAdd function would be the best way to handle it.

The formula I used is:

Code:
if (DateAdd ("yyyy",-1 ,{SOP30200.DOCDATE} ))
then {SOP30300.QTYTOINV}
else
0

but an error comes back and tells me a Boolean is required here. What does that mean and how should I change my formula to have it accept it. I need the {SOP30300.QTYTOINV} to sum if the {SOP30200.DOCDATE} falls in last year else do not add to the sum.

Any help would be appreciated.

Thanks
 
Try:

if {SOP30200.DOCDATE}>= Date(Year(currentDate)-1,01,01) and
{SOP30200.DOCDATE}<= Date(Year(currentDate)-1,12,31) then {SOP30300.QTYTOINV}
else
0


Reebo
UK

Please Note - Due to current economic forcast and budget constraints, the light at the end of the tunnel has been switched off. Thank you for your cooperation.
 
Reebo thanks so much. That was exactly what I needed. You saved my butt.

:)

Thanks
Mark

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top