473,545 Members | 1,151 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Week Numbers in Stephan Leban's MonthCalendar

I noticed that the week numbers in Stephan Leban's MonthCalendar are not consistent with Microsoft Outlook (they are shifted one week forward). Is there any way I can sync these two up by changing something in the module or the code in Stephan's MonthCalendar?
Thanks,
TySmith

--
Message posted via http://www.accessmonster.com
Nov 13 '05 #1
10 3873
Hi Ty,
the class currently does not expose theSetFirstDayO fTheWeek property. If
this is the property you require let me know and I'll post some code for
you to add to the class.
Here is the info from MSDN.
MCM_SETFIRSTDAY OFWEEK Message

------------------------------------------------------------------------
--------

Sets the first day of the week for a month calendar control. You can
send this message explicitly or by using the MonthCal_SetFir stDayOfWeek
macro.

Syntax
To send this message, call the SendMessage function as follows.
lResult = SendMessage( // returns LRESULT in lResult (HWND)
hWndControl, // handle to destination control (UINT)
MCM_SETFIRSTDAY OFWEEK, // message ID (WPARAM) wParam, // =
0; not used, must be zero (LPARAM) lParam // = (LPARAM) (INT)
iDay; );
Parameters

wParam
Must be zero.
iDay
Value of type int representing which day is to be set as the first day
of the week. This value must be one of the day numbers.
Return Value

Returns a DWORD value that contains two values. The high word is a BOOL
value that is nonzero if the previous first day of the week did not
equal LOCALE_IFIRSTDA YOFWEEK, or zero otherwise. The low word is an INT
value that represents the previous first day of the week.
Remarks

If the first day of the week is set to anything other than the default
(LOCALE_IFIRSTD AYOFWEEK), the control will not automatically update
first-day-of-the-week changes based on locale changes.
Month Calendar Day Numbers

------------------------------------------------------------------------
--------

This section lists the numeric representations of the days of the week
used by the month calendar control.

Constants

Value
Day of Week

0
Monday

1
Tuesday

2
Wednesday

3
Thursday

4
Friday

5
Saturday

6
Sunday

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"Ty Smith via AccessMonster.c om" <fo***@AccessMo nster.com> wrote in
message news:17******** *************** *******@AccessM onster.com...
I noticed that the week numbers in Stephan Leban's MonthCalendar are not consistent with Microsoft Outlook (they are shifted one week
forward). Is there any way I can sync these two up by changing
something in the module or the code in Stephan's MonthCalendar? Thanks,
TySmith

--
Message posted via http://www.accessmonster.com


Nov 13 '05 #2
I just had a peek at the Calendar config options In MS OUtlook.
To have my MonthCalendar synch up week swith Outlook's you would have
to:
Menu -> Tools-Options.
Select Calendar Options.
Change First Week of year to "First 4 day week"

The Microsoft MonthCalendar common control notes:
MCS_WEEKNUMBERS
Version 4.70. The month calendar control will display week numbers
(1-52) to the left of each row of days. Week 1 is defined as the first
week that contains at least four days.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"Ty Smith via AccessMonster.c om" <fo***@AccessMo nster.com> wrote in
message news:17******** *************** *******@AccessM onster.com...
I noticed that the week numbers in Stephan Leban's MonthCalendar are not consistent with Microsoft Outlook (they are shifted one week
forward). Is there any way I can sync these two up by changing
something in the module or the code in Stephan's MonthCalendar? Thanks,
TySmith

--
Message posted via http://www.accessmonster.com


Nov 13 '05 #3
Stephan,
Your information is OUTSTANDING! I looked up the ISO 8601 standard and I can change my system to accomodate this standard. Thank you for your assistance. Maybe you may want to consider these various options in your next revision of your robust MonthCalendar.
Thanks,
TySmith

--
Message posted via http://www.accessmonster.com
Nov 13 '05 #4
Stephan,
After further review, the week numbering system in Access is not ISO standards and is not consistent with your calendar and the stardard system has a glitch.

If I run these queries, Access returns:
DatePart("ww",# 12/31/2004#) ---> Week 53
DatePart("ww",# 1/1/2005#) ---> Week 1
DatePart("ww",# 1/2/2005#) ---> Week 2

I would like to use ISO standards, but could not find a simple ISOWEEK function anywhere for Access. How did you calculate this for your calendar? Do you have a simple function?
Thanks again,
TySmith

--
Message posted via http://www.accessmonster.com
Nov 13 '05 #5
Ty there is not much I can do to help you with this issue. It's not my
Calendar it is the Microsoft MonthCalendar instantiated directly from
the Microsoft Common Controls DLL.

1) Try starting a new thread on this ISO standards issue.

2) Search GoogleGroups for all Access NGs and "ISO Date"

http://groups.google.com/groups?as_q...=images&as_ugr
oup=*access*&lr =&num=100&hl= en

The very first hit gives a very long thread with several solutions to
calculate the ISO weeknumber.
http://groups.google.com/groups?hl=e...46oe%241%40new
s.wave.co.nz&rn um=1&prev=/groups%3Fas_q%3 D%2522ISO%2520d ate%2522%26safe %
3Dimages%26as_u group%3D*access *%26lr%3D%26num %3D100%26hl%3De n
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"Ty Smith via AccessMonster.c om" <fo***@AccessMo nster.com> wrote in
message news:5c******** *************** *******@AccessM onster.com...
Stephan,
After further review, the week numbering system in Access is not ISO standards and is not consistent with your calendar and the stardard
system has a glitch.
If I run these queries, Access returns:
DatePart("ww",# 12/31/2004#) ---> Week 53
DatePart("ww",# 1/1/2005#) ---> Week 1
DatePart("ww",# 1/2/2005#) ---> Week 2

I would like to use ISO standards, but could not find a simple ISOWEEK function anywhere for Access. How did you calculate this for your
calendar? Do you have a simple function? Thanks again,
TySmith

--
Message posted via http://www.accessmonster.com


Nov 13 '05 #6
Stephan,

Thanks for pointing me in the right direction. After further research, I found a great VBA function that computes ISO week numbers. It was written by John Green, one of the Excel MVPs.

Function ISOWeekNum(TheD ate As Date, Optional NumFormat As Long = 1) As Long
Dim y As Long
Dim YearStart As Date
Dim NextYearStart As Date
Dim N As Long

y = Year(TheDate)
YearStart = ISOYearStart(y)
NextYearStart = ISOYearStart(y + 1)
If TheDate >= NextYearStart Then 'end of December
y = y + 1
YearStart = NextYearStart
ElseIf TheDate < YearStart Then 'early January
y = y - 1
YearStart = ISOYearStart(y)
End If
N = (TheDate - YearStart) \ 7 + 1

Select Case NumFormat
Case 1: ISOWeekNum = N
Case 2: ISOWeekNum = (y Mod 100) * 100 + N
Case 3: ISOWeekNum = y * 100 + N
End Select
End Function

Function ISOYearStart(Th eYear As Long) As Date
Dim Jan4 As Date

Jan4 = DateSerial(TheY ear, 1, 4)
'Start week on Monday
' ISOYearStart = Jan4 - Weekday(Jan4, vbMonday) + 1
'Start week on Sunday
ISOYearStart = Jan4 - Weekday(Jan4, vbSunday) + 1
End Function

--
Message posted via http://www.accessmonster.com
Nov 13 '05 #7
Glad you have found a resolution and thanks for posting it here!
:-)

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"Ty Smith via AccessMonster.c om" <fo***@AccessMo nster.com> wrote in
message news:18******** *************** *******@AccessM onster.com...
Stephan,

Thanks for pointing me in the right direction. After further research, I found a great VBA function that computes ISO week numbers.
It was written by John Green, one of the Excel MVPs.
Function ISOWeekNum(TheD ate As Date, Optional NumFormat As Long = 1) As Long Dim y As Long
Dim YearStart As Date
Dim NextYearStart As Date
Dim N As Long

y = Year(TheDate)
YearStart = ISOYearStart(y)
NextYearStart = ISOYearStart(y + 1)
If TheDate >= NextYearStart Then 'end of December
y = y + 1
YearStart = NextYearStart
ElseIf TheDate < YearStart Then 'early January
y = y - 1
YearStart = ISOYearStart(y)
End If
N = (TheDate - YearStart) \ 7 + 1

Select Case NumFormat
Case 1: ISOWeekNum = N
Case 2: ISOWeekNum = (y Mod 100) * 100 + N
Case 3: ISOWeekNum = y * 100 + N
End Select
End Function

Function ISOYearStart(Th eYear As Long) As Date
Dim Jan4 As Date

Jan4 = DateSerial(TheY ear, 1, 4)
'Start week on Monday
' ISOYearStart = Jan4 - Weekday(Jan4, vbMonday) + 1
'Start week on Sunday
ISOYearStart = Jan4 - Weekday(Jan4, vbSunday) + 1
End Function

--
Message posted via http://www.accessmonster.com


Nov 13 '05 #8
Stephen,
Your calendar seems to update the field without a trace. How do you run an event on the exit or after the field populates? I tried, After Update, Before Update, On Change, On Exit and none of them seem to work. I even tried to use a Call in the code and that definitely doesn't work. Any suggestions?
Ty

--
Message posted via http://www.accessmonster.com
Nov 13 '05 #9
Ty the ShowMonthCalend ar function simply returns the date selected by
the User. It is up to you to then decide whether you want to update the
field or not.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"Ty Smith via AccessMonster.c om" <fo***@AccessMo nster.com> wrote in
message news:ab******** *************** *******@AccessM onster.com...
Stephen,
Your calendar seems to update the field without a trace. How do you run an event on the exit or after the field populates? I tried, After
Update, Before Update, On Change, On Exit and none of them seem to work.
I even tried to use a Call in the code and that definitely doesn't work.
Any suggestions? Ty

--
Message posted via http://www.accessmonster.com


Nov 13 '05 #10

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

Similar topics

20
5007
by: Laguna | last post by:
Hi Gurus, I want to find the expiration date of stock options (3rd Friday of the month) for an any give month and year. I have tried a few tricks with the functions provided by the built-in module time, but the problem was that the 9 element tuple need to be populated correctly. Can anyone help me out on this one? Thanks a bunch, Laguna
2
7611
by: Simon Pleasants | last post by:
I recently built a database to help keep track of shipments we are bringing into the country. Included in the database are a number of fields with dates for shipment, ETA etc. Each one of these is accompanied by a "week no" relating to the week in the calendar year (I am sure many people are familiar with working with week nos and know...
16
3038
by: DFS | last post by:
If you're listening, I want the middle of the calendar (showing 1 month) to open below the cursor position. It currently opens just to the right and below the cursor position. I hunted through the code, but can't determine what to alter. Very nice piece of work, by the way. Thanks
13
3651
by: steven | last post by:
A monthcalendar checks every 2 minutes if theres a new day. Does anyone knows how to disable this ? The problem is that, everytime a monthcalendar checks this, the form where the monhcalendar is on, gets the focus, which is VERY annoying. Thanks, Steven
0
1362
by: steven | last post by:
Start a new project with 2 forms: one with a datagrid, a button and a monthcalendar, and another form without controls. Try this code in your form with the monthcalendar: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim frm As Form frm = New Form2 frm.Show()
8
2605
by: vbmark | last post by:
I want the MonthCalendar control to return the single day selected. I have MaxSelectionCount = 1. What I get back though is this: "SelectionRange: Start: 5/5/2005 12:00:00 AM, End: 5/5/2005 12:00:00 AM" How do I get the single day date?
1
1575
by: Chesne | last post by:
Does anyone know if it is possible to link Leban's Calendar to a table so that when it is activated it will show previous dates which have been booked? TIA - Ray
5
8713
by: Randy | last post by:
Based on the date that the user selects, I'm trying to make the MonthCalendar control highlight the entire week. In my case, the week is from Monday - Sunday. I thought that using AddBoldedDate along with selectionrange.start and .end would accomplish this, but it doesn't. Here is my code: Private Sub MonthCalendar1_DateChanged(ByVal...
11
7362
by: Randy | last post by:
I have a MonthCalendar on one of my forms. I have disovered that the DateChanged event is triggered not only when the user clicks on a new date, but also if they click on the Previous or Next Month arrows (meaning they click on either of the left or right pointing arrows in the top corner). If the user changes the month, it messes up some of...
0
7391
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7651
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7802
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7746
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5962
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3438
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1869
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1010
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
693
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.