Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Detecting when the week number changes

Posted on 2003-10-28
2
Medium Priority
?
161 Views
Last Modified: 2010-05-03
Hi Experts,

I know how to get the week number in visual basic using:

datepart("ww", date)

But does anyone know how to trigger an event when the week number changes?

Preferably without the use of a timer control


Thanks,
Robbrownuk
0
Comment
Question by:robbrownuk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 9633016
You do need to create a 'timer' to listening your request, then your application then can rect based on the response returned from the listener.

Alternatively by Not using a timer control, you can do a timer via SetTimer API, example like below:

http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q180/7/36.asp&NoWebContent=1

http://www.mvps.org/vbnet/code/forms/flashwindowsettimer.htm

Hope this helps
0
 
LVL 16

Accepted Solution

by:
JohnBPrice earned 90 total points
ID: 9633874
Are you just waiting for the week to change?  A simple way would be to sleep until it happens.  Note you don't want to sleep too long at a shot or your app won't respond to shutdown requests, etc.

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Private Sub Command1_Click()
    Dim currentweek As Integer
    currentweek = DatePart("ww", Date)
    While currentweek = DatePart("ww", Date)
        Sleep (5000) 'sleep for 5 seconds
    Wend
    'now the week has changed
End Sub
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question