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

DateAdd and yyyymm?

Status
Not open for further replies.

MaddiMond

Technical User
Mar 28, 2005
76
US
Hi there,

I have a calculated field [date] in a report that has the format yyyymm. One subreport is linked to this field.
I tried to add another calculated field with DateAdd ("m",2,[date]), but it did not work because of the format. The problem is that I have to link the second subreport to a date that is 2 month later than the [date] field.
Is there anyway I can add 2 months to a date format of yyyymm?

Thanks,

Maddi
 
Try putting this in an unbound text box on the report.

=Format(IIf(CInt(Right([date],2))<11,Left([date],4),Cint(Left([date],4))+1),"00") & Format(IIf(Cint(Right([date],2))<11,CInt(Right([date],2))+2,CInt(Right([date],2))-10),"00")

This may be a drawn out way of doing it, but it works. =]

-Pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top