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

Can you use a parameter field to pass a value to the dateserial funct?

Status
Not open for further replies.

khekking

Technical User
Jul 26, 2006
21
US
I have a report that looks at six months prior and six months after one of our sales people have visited the account.

I would like to make the report dynamic, that is I would like to pass a paremeter to the formula so I can adjust how many months prior and post visit the data looks at.

My current formula:

If {Invoice_Detail.INVDTE_32} in dateserial(year({@last visit date}), month({@last visit date})-6,1) to
dateserial(year({@last visit date}), month({@last visit date})-0,0)-1
then {@Ext. Price}

I would like to replace the -6 with a parameter field {?begin date} so that I can modify the value to my choosing.

When I attempt to add the paremeter field to the formula, Crystal responds: "the ) is missing"

Any ideas?

thanks for the help.
 
Forgot to include the revised formula that Crystal doesn't like.

If {Invoice_Detail.INVDTE_32} in dateserial(year({@last visit date}), month({@last visit date}){?Number of months prior to visit},1) to
dateserial(year({@last visit date}), month({@last visit date})-0,0)-1
then {@Ext. Price}
 
You left out the minus. Not sure why you are using 0 for the day in conjunction with -1. 0 will give you the last day of the previous month, but with the -1, you would get the last day minus one. I think the zero should be 1:

If {Invoice_Detail.INVDTE_32} in dateserial(year({@last visit date}), month({@last visit date}) - {?Number of months prior to visit},1) todateserial(year({@last visit date}), month({@last visit date})-0,1)-1 then
{@Ext. Price}

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top