Page 2 of 2 FirstFirst 12
Results 16 to 23 of 23
  1. #16
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    Quote Originally Posted by ArviLaanemets View Post
    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)
    That makes the most sense to me - or use a table, both of which were suggested in post 4 but seemingly ignored. My turn.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  2. #17
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    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,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  3. #18
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,365
    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;Friday
    Code:
    dtNewDate = Date + 7 + (Weekday(Date) - Me.cboDay)
    
    MsgBox (dtNewDate)
    
    
    Me.DelDate = dtNewDate
    
    
    Exit Sub
    Click image for larger version. 

Name:	Capture2.JPG 
Views:	11 
Size:	13.2 KB 
ID:	49610

  4. #19
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,365
    Cheers Vlad, of course this should be very simple for me even!!!! just brain frozen

  5. #20
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,365
    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

    ?

  6. #21
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,365
    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

  7. #22
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    @Dave - just in case, here is another way of doing it.

    Cheers,
    Attached Files Attached Files
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  8. #23
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,365
    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

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 10
    Last Post: 01-23-2016, 12:29 PM
  2. Replies: 9
    Last Post: 06-19-2015, 03:37 PM
  3. Replies: 3
    Last Post: 01-21-2015, 02:40 PM
  4. Replies: 4
    Last Post: 09-29-2014, 12:24 PM
  5. Replies: 3
    Last Post: 04-01-2012, 01:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums