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

Need 2 Formulas in One Field 2

Status
Not open for further replies.

hebuna

Technical User
Feb 14, 2006
8
US
I'm a newbie using Crystal Reports 11 & SQL Server.

I am trying to change both the date and year in a field. I know how to do one or the other:

DateAdd ("YYYY",+2,{SCContracts.ExpDate}) or
DateAdd ("D",-1,{SCContracts.ExpDate})

but I don't know how to make it do both. Any suggestions? Thanks!
 
Try:

dateserial(year({SCContracts.ExpDate})+2, month({SCContracts.ExpDate}), day({SCContracts.ExpDate})-1)

-LB
 
Try:

Dateserial(year({SCContracts.ExpDate})+2,month({SCContracts.ExpDate}), day({SCContracts.ExpDate})-1)

or you can gang the dateadds:

DateAdd ("D",-1,DateAdd("YYYY",+2,{SCContracts.ExpDate}))

-k
 
Thank you so much! That was perfect! [2thumbsup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top