|
-
Jun 20th, 2005, 01:55 PM
#1
Thread Starter
Member
Select event depending on day & time
Hey all,
Could someone suggest a good method of doing the following.
I need to fill a label with an event that is occuring depending what the time of the day is. For example, if I have a text file like this:
Monday:
0=EVENT1
1=EVENT1
2=EVENT1
3=EVENT2
4=EVENT3
The file includes each day of the week and the numbers are related to what time it is.
SO, what I need to do is be able to select the correct day and then the correct event (dependant on the time) and display the result in a label!
Any ideas ?
-
Jun 20th, 2005, 02:16 PM
#2
Re: Select event depending on day & time
use this:
VB Code:
Select Case Weekday(Now, vbMonday)
Case 1
MsgBox "Today is Monday", vbInformation
Case 2
MsgBox "Today is Tuesday", vbInformation
Case 3
MsgBox "Today is Wednesday", vbInformation
Case 4
MsgBox "Today is Thursday", vbInformation
Case 5
MsgBox "Today is Friday", vbInformation
Case 6
MsgBox "Today is Saturday", vbInformation
Case 7
MsgBox "Today is Sunday", vbInformation
End Select
-
Jun 20th, 2005, 02:17 PM
#3
Re: Select event depending on day & time
Also for time and date, use these functions:
Hour(Now)
Minute(Now)
Second(Now)
Day(Now)
Month(Now)
Year(Now)
-
Jun 20th, 2005, 02:19 PM
#4
Re: Select event depending on day & time
If you storing data in the file then it wouldn't be best way all arround - I suggest to "switch" to small database like MS Access.
By doing so you will appreciate the difference and flexibility db method offers.
If you decide so then rest will be a breeze ... you may however need to learn some db processing basics.
-
Jun 20th, 2005, 02:21 PM
#5
Thread Starter
Member
Re: Select event depending on day & time
Thanks guys! A DB, never thought of that option! As the events will be updated on a weekly basis.
-
Jun 20th, 2005, 02:23 PM
#6
Re: Select event depending on day & time
No problem
-
Jun 20th, 2005, 02:24 PM
#7
Re: Select event depending on day & time
 Originally Posted by Griffo
... As the events will be updated on a weekly basis.
... and that's the beaty of using database - you may keep existing data for historical purpose for as long as you need it without having any needs to update/delete existing so you can easy report on everything that did happend or will happend.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|