Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2003
    Location
    Slovenia, EU
    Posts
    16

    Unanswered: Show specific Date

    Hi,

    another question. I would like to display only fridays date for the whole active week till Now() = friday after that the function would return next fridays date.

    Theoreticaly should look like this: Suppose friday is 6 and 12 and 18
    The function would show for the whole week fridays date

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
    6 6 6 6 6 6 12 12 12 12 12 12 18 18 18 18 18 18

    But it must be a date not number, this is only for demonstation.

    Can anyone help?
    MS Access 2000 - 2003, WinNT - WinXP

  2. #2
    Join Date
    Oct 2003
    Location
    US
    Posts
    343

    Re: Show specific Date

    Need a better explanantion of what are you trying to do..this is confusing..


    Originally posted by primus
    Hi,

    another question. I would like to display only fridays date for the whole active week till Now() = friday after that the function would return next fridays date.

    Theoreticaly should look like this: Suppose friday is 6 and 12 and 18
    The function would show for the whole week fridays date

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
    6 6 6 6 6 6 12 12 12 12 12 12 18 18 18 18 18 18

    But it must be a date not number, this is only for demonstation.

    Can anyone help?

  3. #3
    Join Date
    Oct 2003
    Location
    São Paulo - Brazil
    Posts
    91
    Try this:

    Code:
    Dim dToday as Date
    Dim dEnd as Date
    
    dToday = Date()
    
    dEnd = dToday + 60 ' Here u change the code and puts the last date
    
    Do While dToday <= dEnd
    
      If Weekday(dToday)  = 6 ' See Help for undertand the function 
        msgBox "Thanks God" & dToday & " is a firday"
      endif
    
      dToday = dToday + 1
    
    Loop
    My environment: Windows XP/ Access 2000 - Using Microsoft DAO 3.6 Library

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    How much control do you have over the database? Are you able to add tables? If so, here is one method:

    First you're going to need a method to determine which week of the month it is. Whereas you want to return a given friday based on days in the same week. Place this in a module/form/wherever you're going to use it:
    Code:
    Public Function GetWeek(dtDate As String) As Integer
    GetWeek = DatePart("ww", dtDate, vbSunday) - DatePart("ww", Month(dtDate) & "/1/" & Str(year(dtDate))) + 1
    End Function
    That will give you the week of any given date passed as a string. Use this to populate a table of fridays and their respective dates with a structure similar to:

    id - Auto
    month - int
    week - int
    friday - date

    Then you can reference this table to find what date friday occurs for any given week. This will come in handy as such:

    SELECT tblFriday.friday
    FROM yrTable INNER JOIN tblFriday ON month(yrTable.yrDate) = month(tblFriday.month) AND GetWeek(yrTable.yrDate) = tblFriday.week

Posting Permissions

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