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!

year to date formula 2

Status
Not open for further replies.

moonknightt

Programmer
May 7, 2002
92
US
I need help on a formula that takes a date parameter and gives me the year to date.

For example: if the user chooses a march date, it will display results from january to march

Thanks
 
Try:

To just display it, use:

totext(cdate(year({?EndDate}),1,1))+" to "+totext({?EndDate})

To use it in a record selection formula, use:

{table.DateField} >= cdate(year({?EndDate}),1,1) and
{table.DateField} <= {?EndDate}

This doesn't hardcode the first date as in dgillz's example, so it will work next year too.

Note that if you have a datetime field, you'll want to verify that both dates are being passed to the database (Database->Show SQL Query).

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top