Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2003
    Posts
    35

    Question Unanswered: Converting day value into appropriate string?

    Is it possible to take a date's day value and convert it into a string for example if 01/07/03 was a Monday, it would take the day (07) and give me the string value (Monday).
    This isn't the most important thing in the world but sometimes it might be useful for the readability in certain scheduling reports.
    "My Idea is that everyone should be required to use small fonts. That way we'll save disk space.
    ~Asok.

  2. #2
    Join Date
    Nov 2002
    Location
    San Francisco
    Posts
    251

    Re: Converting day value into appropriate string?

    format(#01/07/03#, "dddd")

    :-)

    jiri

  3. #3
    Join Date
    Jan 2003
    Posts
    35

    Re: Converting day value into appropriate string?

    Thats pretty sweet.

    How about this now

    On a report that shows weekly employees' schedules. (No user parameters) I want to, as part of the header, include the week starting date and the week ending date. I want the dates to change when the week changes.
    (as well as the employees' schedules, which is already done)

    I.E. 01/05/03 - 01/11/03 is the current week.
    next week the header will automatically change to
    01/12/03 - 01/18/03

    I know how to get the Month, Year and WeekNumber, but to find the Starting day number and Ending day number is tricky.

    any suggestions will be helpful.

    Thanks
    Josh P
    "My Idea is that everyone should be required to use small fonts. That way we'll save disk space.
    ~Asok.

  4. #4
    Join Date
    Nov 2002
    Posts
    150

    Re: Converting day value into appropriate string?

    Originally posted by okiiyama
    Thats pretty sweet.

    How about this now

    On a report that shows weekly employees' schedules. (No user parameters) I want to, as part of the header, include the week starting date and the week ending date. I want the dates to change when the week changes.
    (as well as the employees' schedules, which is already done)

    I.E. 01/05/03 - 01/11/03 is the current week.
    next week the header will automatically change to
    01/12/03 - 01/18/03

    I know how to get the Month, Year and WeekNumber, but to find the Starting day number and Ending day number is tricky.

    any suggestions will be helpful.

    Thanks
    Josh P
    Kind of cheesy but on the date the report is run, you can call a function to do something like this:

    dim tempDate as date
    dim startDate as date
    dim endDate as date

    tempDate = date
    do while weekday(tempDate) <> 1
    tempDate=tempDate-1
    loop
    startDate = tempDate

    tempDate = date
    do while weekday(tempDate) <> 7
    tempDate=tempDate+1
    loop
    endDate = tempDate

  5. #5
    Join Date
    Nov 2002
    Location
    San Francisco
    Posts
    251
    create public function and then use it in any report, form or query...

    something like this:


    Public Function ReturnBeginEndDay(InputDate As Date, Optional blnIsItBegin As Boolean = True) As Date

    If blnIsItBegin Then
    ReturnBeginEndDay = DateAdd("d", 1 - Weekday(InputDate), InputDate)
    Else
    ReturnBeginEndDay = DateAdd("d", 7 - Weekday(InputDate), InputDate)
    End If
    End Function



    then you can use it in any report like this...
    =ReturnBeginEndDay (#01/11/2003#, True) & " - " & ReturnBeginEndDay (#01/11/2003#, False )


    in U.S. week starts on Sunday :-)



    jiri
    Last edited by playernovis; 01-07-03 at 01:03.

Posting Permissions

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