I have a report that uses 2 user entered dates to display the sales in the time period between the two dates. I also am calculating the year to date sales in the same report using dsum and abs functions. I want the year to date sales to use the year entered by the user in the start date field, and the full end date entered by the user. I know I want to use the datepart function but I think my syntax is wrong. Here is what I have for a formula to calculate the actual number of Pontiac Grand Ams sold year to date:
=Sum(Abs([Vehicle]="Pontiac Grand Am" And [N_U]="new" And [sale_date] Between "01/01/" & DatePart("yyyy",[txt1stDate]) And [txt2ndDate]))
[vehicle] is the sold type of vehicle
[N_U] is new or used vehicles
[txt1stDate] is the 1st date entered by the user
[txt2ndDate] is the 2nd date entered by the user
This formula is not working. It does work if I substitute (at the "between" part of the formula) actual dates enclosed w/pound signs.
I searched other posts for hours but couldn't get an answer, so I hope I'm not duplicating anyone's efforts.
Thanks,
Steve
=Sum(Abs([Vehicle]="Pontiac Grand Am" And [N_U]="new" And [sale_date] Between "01/01/" & DatePart("yyyy",[txt1stDate]) And [txt2ndDate]))
[vehicle] is the sold type of vehicle
[N_U] is new or used vehicles
[txt1stDate] is the 1st date entered by the user
[txt2ndDate] is the 2nd date entered by the user
This formula is not working. It does work if I substitute (at the "between" part of the formula) actual dates enclosed w/pound signs.
I searched other posts for hours but couldn't get an answer, so I hope I'm not duplicating anyone's efforts.
Thanks,
Steve