On Jan 25, 3:16 am, sba...@cbpacific.com wrote:
Aloha from Hawaii,
I'm beating my head on the wall here. I have a recruiting contact
managment database I'm trying to create. Managers (there ar 14 of
them) have to make a certain number of recruiting calls per week, and
so many of them have to result in at least an appointment. However,
the "week" is Wednesday, 12:01pm to the following Wednesday, 12:00noon.
So here are my questions...
1) Is there a way to change the standard week in a database to be Wed -
Wed in both the forms and reports? I need to make a form, and a report,
that basically states "You have a quota of 60 calls per month, and a
minimum weekly call of 13. You've made 10 calls this week, so you have
3 calls remaining". Not quite like that but just a text block that
says "Remaining calls: 3". Just wanted to explain what I'm trying to
display.
2) My main form (fed by tblCONTACTS) has a subform (fed by tblCALLS).
On the side of the form, I want to put three buttons, and have subform
update each time a button is selected:
- Display All calls made to this contact (btnALL)
- Display all calls made to this contact month to date (btnMTD)
- Display all calls made to this contact week to date (btnWEEK),
keeping in mind that our week is considered Wednesday noon to the
following Wednesday at noon.
WeekNumber = DatePart("ww", TimeStamp, 4) - Abs(TimeValue(TimeStamp) <=
TimeSerial(12, 0, 0) And Weekday(TimeStamp) = 4)
This takes the week number given by Access for weeks starting on
Wednesdays and subtracts one if the time is before or equal to
Wednesday noon.
Test results:
tblTemp
TimeStamp Date/Time
1/25/2007 12:15:00 PM
1/2/2007 11:45:00 AM
1/3/2007 11:45:00 AM
1/3/2007 12:15:00 PM
1/10/2007 12:00:59 PM
1/10/2007 12:01:00 PM
2/14/2007 8:55:00 AM
1/1/2014 11:45:00 AM
1/1/2014 12:45:00 PM
1/2/2008 11:45:00 AM
SELECT DatePart("ww", TimeStamp, 4) - Abs(TimeValue(TimeStamp) <
TimeSerial(12, 1, 0) And Weekday(TimeStamp) = 4) AS WeekNumber FROM
tblTemp;
WeekNumber
5
1
1
2
2
3
7
0
1
1
If the first day of the year is a Wednesday, Wednesday morning (plus
noon) will be considered week 0. If the first day of the year is on a
Tuesday, Wednesday morning (plus noon) will be considered as part of
week 1. Also note that the DatePart function sometimes has problems
when a firstweekofyear (the second optional parameter) value of
vbFirstFourDays (2) is used. That logic gets a little complicated so I
feel a little sympathy for Microsoft about not getting everything
perfect the first time. The date values shown here are the only ones I
tested. I hope this helps.
James A. Fortune
CD********@FortuneJames.com