Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    527
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Sunday Date return (AXP)

    Hello All,
    I have a text box on a form that displays a date. In another text box I want to display the Sunday date of the first text box's week. How do I do that? I think that it will be something from the format command but I am unsure.....

    Thanks,
    Mark

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Sunday Date return (AXP)

    Let's say that the text box with the date is named txtDate. Set the Control Source of the second text box to

    =[txtDate]-(Weekday([txtDate],2) Mod 7)

    and set its Format property to one of the date formats.

    If txtDate is bound to a date field, you can use the name of the field instead of txtDate in the expression.

    Explanation: the Weekday function returns a number that indicates the day of the week of the first argument. The second argument specifies where the week starts. Using 2 means starting with Monday: Monday = 1, Tuesday = 2, ..., Sunday = 7. We take this number mod 7 so that Sunday becomes 0. Finally, we subtract this from the date - from Monday, subtracting 1 gives Sunday; from Tuesday, subtracting 2 gives Sunday, etc.

  3. #3
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    527
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sunday Date return (AXP)

    Dank Hans!,
    I knew there was a way to do it. It works prefectly.

    Thanks,
    Mark Santos

Posting Permissions

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