Results 1 to 4 of 4
  1. #1
    johnsmith1 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2012
    Posts
    17

    Calculated Date field: Return Week of Month From Date Value

    Hello all, Please assist with the following problem:
    I have a table field named: "Date". I would like to create a query with a calculated field named "Week" that will read the Date value in the table field "Date" and return:
    1 if the date falls in the first week of the respective month
    2 if the date falls in the second week of the respective month
    3 if the date falls in the third week of the respective month
    4 if the date falls in the fourth week of the respective month

    Please assist me with this. Thank you.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    Date is a reserved word and should not use it as a field name. Better would be DateEnter or DateWhatever.

    Some months will have a 5th week.

    Review http://www.vbaexpress.com/kb/getarticle.php?kb_id=1085
    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
    johnsmith1 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2012
    Posts
    17
    Thanks for the answer. Actually, I just said "Date" here to keep my post as short and precise as possible, and am familiar with the rules on field naming in Ms Access tables. The actual name is "DateTime Caught". I am checking out the link.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    Also recommend avoid spaces in names as well as special characters and punctuation (underscore is exception).

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

Similar Threads

  1. Group by Week for any given start date
    By royalrochelle in forum Queries
    Replies: 3
    Last Post: 02-15-2012, 08:44 PM
  2. Replies: 1
    Last Post: 03-01-2011, 04:03 PM
  3. how to convert week number to date range
    By qwang1115 in forum Access
    Replies: 1
    Last Post: 02-13-2009, 11:35 AM
  4. Setting criteria in a calculated date field
    By SteveReberger in forum Access
    Replies: 0
    Last Post: 10-29-2008, 06:58 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