Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Apr 2003
    Location
    Kontich, Vlaanderen, Belgium
    Posts
    103
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Determine day of week from date (Acces 97 - SR1)

    Hi all,

    I have an input form where a date has to be filled in. Now I would like have the exact day of week (Monday, Tuesday,...) shown on the input form, next to to the date that was put in. I feel I should not ask the user to also fill in the day of week, it should be calculated automatically.

    I also would like to store this day of week, because I would like to query the database on this field (how may records on an Monday or so).

    Can someone point me in the right direction, please ?

    MTIA,

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

    Re: Determine day of week from date (Acces 97 - SR1)

    You don't need to store the day of the week, you can calculate it in a query. The Weekday function returns a number corresponding to the day of the week: Weekday([DateField]) returns 1 for Sunday, 2 for Monday etc. You can also specify which day is the first day of the week: Weekday([DateField],4) returns a day number where Wednesday = 1, Thursday = 2 etc. You can look up Weekday in the online help.

  3. #3
    2 Star Lounger
    Join Date
    Apr 2003
    Location
    Kontich, Vlaanderen, Belgium
    Posts
    103
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Determine day of week from date (Acces 97 - SR1)

    Thanks for your reply Hans,

    I understand that the Weekday function returns a number representing the day of the week.
    How can I make the input form show the day itself (Monday, Tuesday, ...) in stead of the number ?
    I did not find this in the Help (maybe I overlooked it ?).

    Any hints ?

    MTIA

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

    Re: Determine day of week from date (Acces 97 - SR1)

    If it's just for display, you don't need the Weekday function at all, you can use a text box bound to the date field. You can set the Format property of the text box: ddd is the code for the abbreviated day name (Mon, Tue, Wed, ...) and dddd is the code for the full day name.

  5. #5
    2 Star Lounger
    Join Date
    Apr 2003
    Location
    Kontich, Vlaanderen, Belgium
    Posts
    103
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Determine day of week from date (Acces 97 - SR

    Hi Hans,

    I just added the bound text box to my input form, and (of course) it worked !

    I understand that, when I make a query on the database, I can calculate the day of the week using the Weekday function (as you indicated in your first reply). I did not try this yet. If I should encounter a problem there, I will come back to this thread.

    Thank you and best regards,

Posting Permissions

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