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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formula to show correct month data 2

Status
Not open for further replies.

rwn

Technical User
Dec 14, 2002
420
0
0
US
I have the following formula for example the month of July. When the record displays it will show that data for July 2008. But I keep getting an error in the formula. If the data is in the current year and the month of July it needs to show the calculation of {Delivery.Promised_Quantity}*{Job.Unit_Price}. Thanks for any guidence and advise.
.....................
local Datevar m:= MonthName(7);
local numbervar y:= year(today);
if month({Delivery.Promised_Date}) = Month(7)//July
and year({Delivery.Promised_Date}) = y then //current year
{Delivery.Promised_Quantity}*{Job.Unit_Price}//then show data
...........................
 
monthname(7) is a string, not a date, so you would have to use stringvar, but you don't reference this in your formula, and you don't need variables anyway. You can just use:

if month({Delivery.Promised_Date}) = 7 and //or month(currentdate)
year({Delivery.Promised_Date}) = year(currentdate) then
{Delivery.Promised_Quantity}*{Job.Unit_Price}

You could substitute in the month(currentdate) instead of the "7" above, if you really are aiming for the current month.

-LB
 
Try:
If Month({Delivery.Promised_Date}) = Month(Today) and
Year({Delivery.Promised_Date}) = Year(Today) then
{Delivery.Promised_Quantity}*{Job.Unit_Price}

MrBill
 
Thanks to both, very helpful and works perfect. Back to getting the report done. Thanks again!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top