Results 1 to 3 of 3
  1. #1
    cschieff is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    1

    Adding the day of the week to a date field


    Hi all,

    I have a cemetery database that has a date field called date of interment (date of burial) in the form of MM/DD/YYYY. What I would like to be able to do is create a report that will select what day of the week (Monday, Tuesday, etc) a burial took place based on this date field. Currently, I have created a report that allows me to enter a start and stop date, and this report gives me all records between those two dates. For example, if I enter a start date of 01/01/1970 and a stop date of 01/01/1971, I will get back a list of all people buried between these dates. Is there a way I can add another column that will also give me the day of the week that this burial occured? Or how can I create a report so that I can type in a day of the week (for example Saturday) and get back all records of burials that took place on a Saturday?

    Thanks,

    Chase

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    if you're doing it in a query you'd have to use a nested if statement like:

    Code:
    DayText: iif(isnull([date of burial]), null, iif(weekday([date of burial]) = 1, "Sunday", iif(weekday([date of burial]) = 2, "Monday",iif(weekday([date of burial]) = 3, "Tuesday",iif(weekday([date of burial]) = 4, "Wednesday",iif(weekday([date of burial]) = 5, "Thursday",iif(weekday([date of burial]) = 6, "Friday",iif(weekday([date of burial]) = 7, "Saturday", "Unknown"))))))))
    didn't test the code so I may be off on the parentheses but you get the idea.

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Or use Format function:

    [date of burial] = 1/1/1970

    Format([date of burial],"ddd") = Thu
    Format([date of burial],"dddd") = Thursday
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 04-01-2012, 01:40 PM
  2. Group by Week for any given start date
    By royalrochelle in forum Queries
    Replies: 3
    Last Post: 02-15-2012, 08:44 PM
  3. Replies: 10
    Last Post: 04-21-2010, 01:16 PM
  4. how to convert week number to date range
    By qwang1115 in forum Access
    Replies: 1
    Last Post: 02-13-2009, 11:35 AM
  5. Retrieving Week of Year in a date range
    By Korvega in forum Queries
    Replies: 2
    Last Post: 05-27-2006, 06:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums