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!

date range in header 1

Status
Not open for further replies.

INTP

Technical User
Jan 4, 2003
42
0
0
US
I have a monthly report, and I want the header to automatically display the date range for the month of the data in the report.

I tried inserting the DataDate finction from the Document Properties in the formula editor... but it displays todays date rather than the date of the data that I'm using.
 
If you have limited your report to one month, and if the date field cannot be null, then the following formula should work:

totext({table.date}-day({table.date})+1,"MM/dd/yyyy") + " to " +
totext(dateadd("m",1,{table.date}-day({table.date})+1)-1,"MM/dd/yyyy")

-LB
 
Yes, thank you. That did work. Now, just out of curiosity, if I were to change it to a annual, quarterly, weekly or daily report? What would I need to change to get the date to display?
 
Yearly:
totext(date(year({table.date}),1,1),"MM/dd/yyyy") + " to " +
totext(date(year({table.date}),12,31),"MM/dd/yyyy")

Quarterly:
totext(dateserial(year({table.date}), (datepart("q",{table.date})*3)-2,1),"MM/dd/yyyy") + " to " +
totext(dateserial(year({table.date}), (datepart("q",{table.date})*3)+1,1)-1,"MM/dd/yyyy")

Weekly:
totext({table.date}-dayofweek({table.date})+1, "MM/dd/yyyy") + " to " +
totext({table.date}-dayofweek({table.date})+7, "MM/dd/yyyy")

Daily:
{table.date}

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top