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

Date Range

Status
Not open for further replies.

crystalbeginner15

Programmer
Sep 6, 2005
76
US
I have a monthly report for which I need to have all 4 weeks or 6 weeks of data. So I just want to put a condition while selecting the date that when the user selects the date range ,
I want the user to always select the first day of month as start date and last day of the month as end date. Is there any way I can do it.
 
You can get the year and month as numeric values, ToText({date}, "yy/MM") or as Year({date}) and Month({date})

You don't say how you derive the 4 or 6 months. This could be done by DateAdd("m", {currentdate}, -4)), with months and years derived from this modified date.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
You could ask the user to select any date in the month they wish to report on, and then write a record selection formula like:

{table.date} in date(year({?date}),month({?date}),1) to dateserial(year({?date}),month({?date})+1,1)-1

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top