Hey guys,
For the last, um, forever, my company has been paying bonuses on a monthly basis. I have a program that, upon open, determines the date range to run a report. That report is then sent out to the respective branch managers, and the program closes itself. If the day is the first of the month, it runs the report for the entire last month. Otherwise it picks the to and from dates to be the first day of the month and yesterday, respectively. Here is the code that accomplishes that:
Code:
'Sets the to and from dates
If DatePart("d", Date) = 1 Then
datefrom = DateSerial(DatePart("yyyy", Date), DatePart("m", Date) - 1, 1)
dateto = DateSerial(DatePart("yyyy", Date), DatePart("m", Date), 0)
Else
datefrom = DateSerial(DatePart("yyyy", Date), DatePart("m", Date), 1)
dateto = DateSerial(DatePart("yyyy", Date), DatePart("m", Date), DatePart("d", Date) - 1)
End If
Forms![Montage Sales_gers]!fromdate = datefrom
Forms![Montage Sales_gers]!todate = dateto
Starting yesterday, the powers that be have decided to pay the bonuses out on a biweekly schedule. The periods will be a Monday thru the next Sunday, i.e. 1/5/15 - 1/18/15.
I cannot figure out how to do this. Any thoughts?
If you can even put me on the right track that would be perfect.
Thanks guys!