Results 1 to 4 of 4
  1. #1
    sickel2 is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Sep 2013
    Posts
    2

    Expression needed to assign a "beginning of the week date"

    I have a table called "BOW" that has 2 columns: BOW and EOW (for beginning of the week and end of week).



    I have a table called time that has records of hours employees worked including a field for "time in".

    I want to create an expression that takes the "time in" date, searches between the BOW and EOW in the BOW table, and returns the BOW for the week that the "time-in" falls under.

    Can anyone tell me how to do this or point me towards a resource that can?

    Thanks.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,893
    Not sure you need BOW table. The beginning (and end) of week can be calculated for any given date. What is your beginning of week - Mon, Sun?

    This returns Mon:
    DateAdd("d", Date(), -(Weekday(Date())) + 2)

    This returns Sun:
    DateAdd("d", Date(), -(Weekday(Date())) + 1)
    Last edited by June7; 10-20-2013 at 12:22 AM.
    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.

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I have a table called time
    "Time" is a reserved word and shouldn't be used for object names. Also, it would be better if object names did not have spaces.

    Problem names and reserved words in Access
    http://allenbrowne.com/AppIssueBadWord.html

  4. #4
    sickel2 is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Sep 2013
    Posts
    2
    Thanks June7 for that formula. That formula does obviate the need for a where clause. And thanks Ssanfu for the best practices. I am a beginner and do need to edit these names.

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

Similar Threads

  1. Replies: 2
    Last Post: 04-10-2013, 02:59 PM
  2. Replies: 8
    Last Post: 03-05-2013, 01:20 PM
  3. Replies: 2
    Last Post: 09-29-2012, 11:22 PM
  4. Replies: 4
    Last Post: 06-10-2012, 09:41 PM
  5. Replies: 8
    Last Post: 08-05-2011, 02:55 PM

Tags for this Thread

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