Results 1 to 7 of 7

Thread: Saturday's between to dates

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441
    Like you've got nothing better to do:

    My situation:

    Knowing a MIN DATE and a MAX DATE, how can you display all SATURDAY dates that fall between these two dates in say, a combo box? I am trying to make user pick a valid SATURDAY date.

    Any suggestions. I know I could evaluate the date to detremine it's a Saturday, but I figured the way I described might be easier for the user.
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  2. #2
    Guest
    Take a look at this thread.

  3. #3
    Fanatic Member Gaffer's Avatar
    Join Date
    Nov 2000
    Location
    London
    Posts
    828
    You're right, this is the most interesting code I've written today.

    So:

    Code:
    Sub Saturdays()
    
    Dim dteMin As Date, dteMax As Date
    Dim iDay As Integer, iCount As Integer
    
    dteMin = #1/1/90#
    dteMax = #1/1/10#
    Do Until dteMin = dteMax
        iDay = WeekDay(dteMin)
        If iDay = 7 Then 'i.e. Saturday
            iCount = iCount + 1
        End If
        dteMin = dteMin + 1
    Loop
    
    MsgBox iCount & " Saturdays"
    End Sub

  4. #4
    Frenzied Member
    Join Date
    Aug 2000
    Location
    O!
    Posts
    1,177
    Matthew,

    Well, you lost me ~

    Take a look at this thread = how i can print a picture(jpg,bmp) to printer?


  5. #5
    Fanatic Member Gaffer's Avatar
    Join Date
    Nov 2000
    Location
    London
    Posts
    828
    Of course, my code takes into account that you want to include the Min and Max date in the calculation...

  6. #6

    Thread Starter
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Talking Gaffer

    Thanks.

    After reading your reply, it's obviuos. Thanks for your help. Also, yes I was looking to include the MIN and MAX date in the calculation (Reading my mind).

    Thanks again.
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  7. #7
    Fanatic Member Gaffer's Avatar
    Join Date
    Nov 2000
    Location
    London
    Posts
    828
    Pleasure, was bored anyway. Doing crappy spreadsheet work at the mo

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width