473,407 Members | 2,598 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Changing the standard "week"

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.

Jan 25 '07 #1
3 2591
<sb****@cbpacific.comwrote in message
news:11**********************@k78g2000cwa.googlegr oups.com...
Aloha from Hawaii,
Greetings from freezing England.
>
1) Is there a way to change the standard week in a database to be Wed -
Wed in both the forms and reports?
The way I do it is to have a lookup table with the week numbers in one field
and their week ending date in another, the week ending days being (in my
case) Thursdays. Here's some code to create a lookup table, you'll have to
tweak the dates of course.

Keith.
www.keithwilby.com

Public Sub libMakeDate()

Dim db As DAO.Database
Dim td As DAO.TableDef
Dim fd As DAO.Field
Dim rs As DAO.Recordset
Dim dtmdate As Date

Set db = CurrentDb

' Create a new table
Set td = db.CreateTableDef("tblDate")

' Create a new field
Set fd = New Field
fd.Name = "Date"
fd.Type = dbDate

' Add the field to the table
td.Fields.Append fd

' Create a new field
Set fd = New Field
fd.Name = "WeekNo"
fd.Type = dbText

' Add the field to the table
td.Fields.Append fd

' Add the table to the database
db.TableDefs.Append td

' Open the table
Set rs = td.OpenRecordset

' Add dates and weekno
For dtmdate = #10/27/2002# To #12/31/2010# Step 7
rs.AddNew
rs!Date = dtmdate
rs!WeekNo = Year(dtmdate) Mod 10 & Right("0" & Format(dtmdate,
"ww"), 2)
rs.Update
Next
rs.Close

End Sub
Jan 25 '07 #2
Take a look at the following access function. It works with the day of week
based on a constant set in your program. So you can change the first day of
the week to Wednesday or any other week day. This is straight from the VBA
help file.

Weekday Function
Returns a Variant (Integer) containing a whole number representing the day
of the week.

Syntax

Weekday(date, [firstdayofweek])

The Weekday function syntax has these named arguments:

Part Description
date Required. Variant, numeric expression, string expression, or any
combination, that can represent a date. If date contains Null, Null is
returned.
firstdayofweek Optional. A constant that specifies the first day of
the week. If not specified, vbSunday is assumed.

Settings

The firstdayofweek argument has these settings:

Constant Value Description
vbUseSystem 0 Use the NLS API setting.
vbSunday 1 Sunday (default)
vbMonday 2 Monday
vbTuesday 3 Tuesday
vbWednesday 4 Wednesday
vbThursday 5 Thursday
vbFriday 6 Friday
vbSaturday 7 Saturday
<sb****@cbpacific.comwrote in message
news:11**********************@k78g2000cwa.googlegr oups.com...
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.

Jan 25 '07 #3


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

Jan 25 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

33
by: Steven Bethard | last post by:
I feel like this has probably been answered before, but I couldn't find something quite like it in the archives. Feel free to point me somewhere if you know where this has already been answered. ...
119
by: rhat | last post by:
I heard that beta 2 now makes ASP.NET xhtml compliant. Can anyone shed some light on what this will change and it will break stuff as converting HTML to XHTML pages DO break things. see,...
26
by: Howard Brazee | last post by:
I would like to click on a URL of a html document that will open several URLs at once for me. Does someone have an example of a html document that will do this?
4
by: oyvgi | last post by:
I was wondering if it there is an "easy" way to get the dd-mm-yyyy from ww-yyyy. I would like to get, for example the first day (date-month-year) in the week i specify. Found plenty of ways to...
86
by: Randy Yates | last post by:
In Harbison and Steele's text (fourth edition, p.111) it is stated, The C language does not specify the range of integers that the integral types will represent, except ot say that type int may...
2
by: Kenneth P | last post by:
Hi, I'm trying to find out how I can retrieve the week value of a date. Today we have 2005-05-08 and week 18. Let's say I had a dropdownlist with values 1 to 53 and wanted to...
10
by: sherifffruitfly | last post by:
Hi all, This is how I'm currently getting Friday of last week. It strikes me as cumbersome. Is there a slicker/more elegant way? Thanks for any ideas, cdj
8
by: egrill | last post by:
I have figured out how to extract the serial number of date field into the corresponding number of the week using the DatePart function. The would like to take the 5 and translated it identify the...
18
by: Stephan Beal | last post by:
Hi, all! Before i ask my question, i want to clarify that my question is not about the code i will show, but about what the C Standard says should happen. A week or so ago it occurred to me...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.