Results 1 to 2 of 2
  1. #1
    newbieX is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Posts
    111

    Declare value based on date range without year

    I have about 10000 records and I need to set a value in a separate field if the dates fall between certain planting seasons. Year is irrelevant. Thus if a date falls between a certain range, the Seasons field is filled in with its appropriate planting season. I would prefer to do this via a query interface as it is only a 1 time deal.

    Spring = 3/16 - 5/15
    Summer 5/16-8/15
    Fall 8/16-10/31
    Everything else is Null



    3/20/2015 and 4/16/2013 are both "Spring" in the Season field column
    6/28/2011 and 8/1/2015 are both Summer, etc.
    Ideas as to how I can do this?


    Many thanks.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Pull the month and day parts from the date value.

    Format([fieldname], "mmdd")

    Let x represent that expression:

    Switch(x<="0315",Null, x<="0515","Spring", x<="0815","Summer", x<="1031","Fall", x<="1231",Null)

    No need to populate field. This can be calculated when needed.
    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: 7
    Last Post: 06-07-2015, 11:57 PM
  2. Replies: 4
    Last Post: 04-25-2015, 04:17 PM
  3. Replies: 14
    Last Post: 06-21-2013, 07:18 AM
  4. joins based on date range
    By broecher in forum Database Design
    Replies: 4
    Last Post: 11-04-2011, 06:32 PM
  5. Retrieving Week of Year in a date range
    By Korvega in forum Queries
    Replies: 2
    Last Post: 05-27-2006, 06:29 AM

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