Results 1 to 2 of 2
  1. #1
    allenjasonbrown@gmail.com is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jun 2010
    Posts
    44

    Case Statement Syntax

    I posted this in the query section but maybe I need to post it in the programming section as I have to beleive someone can help me with the proper syntax for a case statement??



    I am trying to figure out the proper syntax for a case statement using between/to dates.

    I have 1 field with a date and would like to set another field to a period.

    case field1
    when field2 between 01/01/09 and 01/31/09 then = 'Y09P01'
    when field2 between 02/01/09 and 02/31/09 then = 'Y09P02'
    etc.....
    end

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    It appears to be getting answered there, so it would be best to keep everything on that thread:

    https://www.accessforums.net/queries...ment-9330.html
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Case or Switch in an update statement
    By allenjasonbrown@gmail.com in forum Queries
    Replies: 7
    Last Post: 11-17-2010, 01:49 AM
  2. IIf Statement Syntax Error
    By shexe in forum Queries
    Replies: 2
    Last Post: 10-06-2010, 08:35 AM
  3. Incomplete Syntax Clause (syntax error)
    By ajetrumpet in forum Programming
    Replies: 4
    Last Post: 09-11-2010, 10:47 AM
  4. Select statement syntax?
    By ksmith in forum Programming
    Replies: 3
    Last Post: 06-24-2010, 09:21 AM
  5. Syntax Error In Insert Into Statement
    By frankvfox in forum Queries
    Replies: 1
    Last Post: 09-09-2008, 12:35 PM

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