Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Apr 2001
    Location
    Melbourne, Australia
    Posts
    118
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Dates in Access (Access 2000)

    Hi all,

    This is probably an easy question, I know you can set the date in a table or report to Now() - so that it displays the current date, however is it posible to put a date that displays the week ending( the Friday)?
    So when you go into a table or report is will display Friday's date of that particular week in the week-ending field.

    Thanks kindly,

    Kerrie <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  2. #2
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    The Netherlands
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Dates in Access (Access 2000)

    DateAdd("d", vbFriday - WeekDay(Date), Date)
    should do the job.

  3. #3
    2 Star Lounger
    Join Date
    Apr 2001
    Location
    Melbourne, Australia
    Posts
    118
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Dates in Access (Access 2000)

    Hi Bart,

    Thanks for your assistance, it has put me on the right track. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>
    I am still having a few problems - it says I am entering an incorrect operator. What I have done, created a field in a table named Week Ending, data type is datetime and default value is the code you send me.
    Is that correct? Have I missed something?

    Thanks Kindly,

    Kerrie <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Dates in Access (Access 2000)

    You can't use constants like vbFriday in formulas in tables or queries. You have to use their numeric equivalent instead. Look up the DateAdd function in on-line help for information on the day constants and their equivalent values.
    Charlotte

  5. #5
    kitT
    Guest

    Re: Dates in Access (Access 2000)

    Try this expression in the default value of your table (assuming your default week start day is Sunday). This should show the Friday of the same week as the current date.

    Date()-Weekday(Date())+6

    <img src=/S/2cents.gif border=0 alt=2cents width=15 height=15>

Posting Permissions

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