Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old February 25th, 2005, 06:54 AM
xpetex xpetex is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 56 xpetex User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 h 50 m 7 sec
Reputation Power: 4
Is this possible....

I want to have buttons accross the top of my form that have the days on them (6 days) from today.

TODAY - TUESDAY - WEDNESDAY - THURSDAY - FRIDAY - SATURDAY - SUNDAY

I have tried all the ways I know, and I have a way using a hidden form but its very messy. Can I put something on form load that would name the buttons correctly? The filtering for the buttons is taken care of I think, im about to do that now. Its just the naming of the buttons.

Any help??

Reply With Quote
  #2  
Old February 25th, 2005, 08:19 AM
hemjal hemjal is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Location: India Gujarat
Posts: 8 hemjal User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 31 m 8 sec
Reputation Power: 0
Send a message via Yahoo to hemjal
Question regarding is it possible ......................

Quote:
Originally Posted by xpetex
I want to have buttons accross the top of my form that have the days on them (6 days) from today.

TODAY - TUESDAY - WEDNESDAY - THURSDAY - FRIDAY - SATURDAY - SUNDAY

I have tried all the ways I know, and I have a way using a hidden form but its very messy. Can I put something on form load that would name the buttons correctly? The filtering for the buttons is taken care of I think, im about to do that now. Its just the naming of the buttons.

Any help??



dear xpetex

can u be quite more clarify that how actually days are related to data so that i can help u more.

Reply With Quote
  #3  
Old February 25th, 2005, 09:36 AM
xpetex xpetex is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 56 xpetex User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 h 50 m 7 sec
Reputation Power: 4
They are simple buttons for a query to use, I have the query set up and runing, its mearly the 'front end' text on the labels...

I have checkboxes, and need the labels to read

sunday, Today, tuesday, wednesday, thursday, friday, saturday, sunday

If we take in to account that the current day is monday.

Reply With Quote
  #4  
Old February 25th, 2005, 09:40 AM
xpetex xpetex is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 56 xpetex User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 h 50 m 7 sec
Reputation Power: 4
So far I can gather that the caption is

labelname.caption = "whatever"

so I tried

labelname.caption = "Date()"

lol, but it actually sets the caption as Date() rather than the date (if that makes sense)

Reply With Quote
  #5  
Old February 25th, 2005, 09:40 AM
xpetex xpetex is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 56 xpetex User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 h 50 m 7 sec
Reputation Power: 4
ahhh done it!!

labelname.caption = date

but how do I make it say the day rather than the numerical value??

Reply With Quote
  #6  
Old February 25th, 2005, 12:00 PM
xpetex xpetex is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 56 xpetex User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 h 50 m 7 sec
Reputation Power: 4
done that too, just did...

Code:
 
Private Sub Form_Load()
LabelToday0.Caption = Weekday(Date, vbUseSystemDayOfWeek) - 1
LabelToday1.Caption = Weekday(Date, vbUseSystemDayOfWeek) + 1
LabelToday2.Caption = Weekday(Date, vbUseSystemDayOfWeek) + 2
LabelToday3.Caption = Weekday(Date, vbUseSystemDayOfWeek) + 3
LabelToday4.Caption = Weekday(Date, vbUseSystemDayOfWeek) + 4
LabelToday5.Caption = Weekday(Date, vbUseSystemDayOfWeek) + 5
LabelToday6.Caption = Weekday(Date, vbUseSystemDayOfWeek) + 6
LabelToday7.Caption = Weekday(Date, vbUseSystemDayOfWeek) + 7
LabelToday8.Caption = Weekday(Date, vbUseSystemDayOfWeek) + 8
LabelToday9.Caption = Weekday(Date, vbUseSystemDayOfWeek) + 9
LabelToday10.Caption = Weekday(Date, vbUseSystemDayOfWeek) + 10
LabelToday11.Caption = Weekday(Date, vbUseSystemDayOfWeek) + 11
Labeltoday12.Caption = Weekday(Date, vbUseSystemDayOfWeek) + 12
If [LabelToday0].[Caption] = "1" Then
[LabelToday0].[Caption] = "Monday"
End If
If [LabelToday0].[Caption] = "2" Then
[LabelToday10].[Caption] = "Tuesday"
End If
If [LabelToday0].[Caption] = "3" Then
[LabelToday0].[Caption] = "Wednesday"
End If
If [LabelToday0].[Caption] = "4" Then
[LabelToday0].[Caption] = "Thursday"
End If
If [LabelToday0].[Caption] = "5" Then
[LabelToday0].[Caption] = "Friday"
End If
If [LabelToday0].[Caption] = "6" Then
[LabelToday0].[Caption] = "Saturday"
LabelToday0.ForeColor = RGB(225, 20, 20)
End If
If [LabelToday0].[Caption] = "7" Then
[LabelToday0].[Caption] = "Sunday"
LabelToday0.ForeColor = RGB(225, 20, 20)
End If
If [LabelToday0].[Caption] = "8" Then
[LabelToday0].[Caption] = "Monday"
LabelToday0.ForeColor = RGB(225, 20, 20)
End If
' First button
 
If [LabelToday1].[Caption] = "1" Then
[LabelToday1].[Caption] = "Monday"
End If
If [LabelToday1].[Caption] = "2" Then
[LabelToday1].[Caption] = "Tuesday"
End If
If [LabelToday1].[Caption] = "3" Then
[LabelToday1].[Caption] = "Wednesday"
End If
If [LabelToday1].[Caption] = "4" Then
[LabelToday1].[Caption] = "Thursday"
End If
If [LabelToday1].[Caption] = "5" Then
[LabelToday1].[Caption] = "Friday"
End If
If [LabelToday1].[Caption] = "6" Then
[LabelToday1].[Caption] = "Saturday"
LabelToday1.ForeColor = RGB(225, 0, 0)
End If
If [LabelToday1].[Caption] = "7" Then
[LabelToday1].[Caption] = "Sunday"
LabelToday1.ForeColor = RGB(225, 0, 0)
End If
If [LabelToday1].[Caption] = "8" Then
[LabelToday1].[Caption] = "Monday"
End If
' second button
 
If [LabelToday2].[Caption] = "1" Then
[LabelToday2].[Caption] = "Monday"
End If
If [LabelToday2].[Caption] = "2" Then
[LabelToday2].[Caption] = "Tuesday"
End If
If [LabelToday2].[Caption] = "3" Then
[LabelToday2].[Caption] = "Wednesday"
End If
If [LabelToday2].[Caption] = "4" Then
[LabelToday2].[Caption] = "Thursday"
End If
If [LabelToday2].[Caption] = "5" Then
[LabelToday2].[Caption] = "Friday"
End If
If [LabelToday2].[Caption] = "6" Then
[LabelToday2].[Caption] = "Saturday"
LabelToday2.ForeColor = RGB(225, 0, 0)
End If
If [LabelToday2].[Caption] = "7" Then
[LabelToday2].[Caption] = "Sunday"
LabelToday2.ForeColor = RGB(225, 0, 0)
End If
If [LabelToday2].[Caption] = "8" Then
[LabelToday2].[Caption] = "Monday"
End If
If [LabelToday2].[Caption] = "9" Then
[LabelToday2].[Caption] = "Tuesday"
End If
' button
If [LabelToday3].[Caption] = "1" Then
[LabelToday3].[Caption] = "Monday"
End If
If [LabelToday3].[Caption] = "2" Then
[LabelToday3].[Caption] = "Tuesday"
End If
If [LabelToday3].[Caption] = "3" Then
[LabelToday3].[Caption] = "Wednesday"
End If
If [LabelToday3].[Caption] = "4" Then
[LabelToday3].[Caption] = "Thursday"
End If
If [LabelToday3].[Caption] = "5" Then
[LabelToday3].[Caption] = "Friday"
End If
If [LabelToday3].[Caption] = "6" Then
[LabelToday3].[Caption] = "Saturday"
LabelToday3.ForeColor = RGB(225, 0, 0)
End If
If [LabelToday3].[Caption] = "7" Then
[LabelToday3].[Caption] = "Sunday"
LabelToday3.ForeColor = RGB(225, 0, 0)
End If
If [LabelToday3].[Caption] = "8" Then
[LabelToday3].[Caption] = "Monday"
End If
If [LabelToday3].[Caption] = "9" Then
[LabelToday3].[Caption] = "Tuesday"
End If
If [LabelToday3].[Caption] = "10" Then
[LabelToday3].[Caption] = "Wednesday"
End If
' button
If [LabelToday4].[Caption] = "1" Then
[LabelToday4].[Caption] = "Monday"
End If
If [LabelToday4].[Caption] = "2" Then
[LabelToday4].[Caption] = "Tuesday"
End If
If [LabelToday4].[Caption] = "3" Then
[LabelToday4].[Caption] = "Wednesday"
End If
If [LabelToday4].[Caption] = "4" Then
[LabelToday4].[Caption] = "Thursday"
End If
If [LabelToday4].[Caption] = "5" Then
[LabelToday4].[Caption] = "Friday"
End If
If [LabelToday4].[Caption] = "6" Then
[LabelToday4].[Caption] = "Saturday"
LabelToday4.ForeColor = RGB(225, 0, 0)
End If
If [LabelToday4].[Caption] = "7" Then
[LabelToday4].[Caption] = "Sunday"
LabelToday4.ForeColor = RGB(225, 0, 0)
End If
If [LabelToday4].[Caption] = "8" Then
[LabelToday4].[Caption] = "Monday"
End If
If [LabelToday4].[Caption] = "9" Then
[LabelToday4].[Caption] = "Tuesday"
End If
If [LabelToday4].[Caption] = "10" Then
[LabelToday4].[Caption] = "Wednesday"
End If
If [LabelToday4].[Caption] = "11" Then
[LabelToday4].[Caption] = "Thursday"
End If
' button
 
............... bla bla



I hope this helps anyone in the same predicament..

If anyone knows how to tidy this code up PLEASE let me know, its pretty hardcore... im sure there is a better way.

Reply With Quote
  #7  
Old February 28th, 2005, 03:15 AM
hemjal hemjal is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Location: India Gujarat
Posts: 8 hemjal User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 31 m 8 sec
Reputation Power: 0
Send a message via Yahoo to hemjal
Thumbs up Try This Function

Quote:
Originally Posted by xpetex
done that too, just did...


dear friend

Try this code replacing ur tidy code The below code will directly get u the day of the week.

Label1.Caption = Format(Date, "dddd", vbUseSystemDayOfWeek)

Do reply me if it helps u out.

Reply With Quote
  #8  
Old February 28th, 2005, 04:57 AM
xpetex xpetex is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 56 xpetex User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 h 50 m 7 sec
Reputation Power: 4
That worked but how do I add days?? like the +1 days.

ps, I hope this can work as ive just eliminated 100 lines of code if it does.

Reply With Quote
  #9  
Old February 28th, 2005, 04:18 PM
xpetex xpetex is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 56 xpetex User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 h 50 m 7 sec
Reputation Power: 4
ok worked it out for anyone else looking:


Label1.Caption = Format(Date, "dddd", vbUseSystemDayOfWeek)

Label2.Caption = Format(Date + 1, "dddd", vbUseSystemDayOfWeek)

Label3.Caption = Format(Date + 2, "dddd", vbUseSystemDayOfWeek)

Label4.Caption = Format(Date + 3, "dddd", vbUseSystemDayOfWeek)

Label5.Caption = Format(Date + 4, "dddd", vbUseSystemDayOfWeek)

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > Is this possible....


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT