That makes the most sense to me - or use a table, both of which were suggested in post 4 but seemingly ignored. My turn.On fly!
You have a combo like cbbWD. Set it's RowSource like
"1,Sunday,2,Monday,3,Tuesday,4,Wednesday,5,Thursda y,6,Friday,7,Saturday", BoundColumn to 1, and ColumnWidths as "0,2.5". When you activate the combo, you see weekday names. When you select a weekday, the value of combo will be the weekday number (form 1 to 7);
You have a text box txtNextDay;
Create a Change event for cbbWD, which sets txtNextDay equal with
Code:Date + 7 + (Weekday(Date) - Me.cbbWD)
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.
The numeric column is not needed as the combo's ListIndex serves its purpose (Sunday = 1 = combo.ListIndex+1 being zero based and first entry).
Cheers,
hello, thank you, this is so so close now after changing to ArviLaaments
its just adding the incorrect date now, must also state, not using Saturday and Sunday, after thought it's only Mon-Fri i am using now
Code:2;Monday;3;Tuesday;4;Wednesday;5;Thursday;6;FridayCode:dtNewDate = Date + 7 + (Weekday(Date) - Me.cboDay) MsgBox (dtNewDate) Me.DelDate = dtNewDate Exit Sub![]()
Cheers Vlad, of course this should be very simple for me even!!!! just brain frozen
Micron, thank you, your method in post 4, you are suggesting to add a table, have a number field and text field
Number field 1 to 7 or for working days only 2 to 6 in Number field
Text field Day Names to relevant number field
?
Got it guy's thank you all, just changed Vlad's + 8 to plus 9 knowing i was 1 day out
Code:dtNewDate = Date - Weekday(Date, Me.cboDay.ListIndex + 1) + 9
@Dave - just in case, here is another way of doing it.
Cheers,
Thank You Vlad, will download and work your method out, I may just use your method, when i thought i had it sorted
No matter what day i selected these at any given week, all worked well apart from Friday, i had to add 7 days for Friday only for some reason based on this:
Code:dtNewDate = Date - Weekday(Date, Me.cboDay.ListIndex + 1) + 9 Me.DelDate = dtNewDate If Left(Me.cboDay, 1) = "6" Then dtFriday = DateAdd("d", 7, dtNewDate) Me.DelDate = dtFriday End If
Will check out your attachment