|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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?? |
|
#2
|
|||
|
|||
|
Quote:
dear xpetex can u be quite more clarify that how actually days are related to data so that i can help u more. |
|
#3
|
|||
|
|||
|
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. |
|
#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) |
|
#5
|
|||
|
|||
|
ahhh done it!!
labelname.caption = date but how do I make it say the day rather than the numerical value?? |
|
#6
|
|||
|
|||
|
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. |
|
#7
|
|||
|
|||
|
Quote:
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. |
|
#8
|
|||
|
|||
|
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. |
|
#9
|
|||
|
|||
|
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) |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft Access Development > Is this possible.... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|