Results 1 to 3 of 3
  1. #1
    dduvvuru is offline Novice
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    2

    Date query help!!!

    Hi!
    I am trying to extract calendar year from a term number.
    Here is the example.


    If the term number is 2096 - then the calendar year is 2008-09
    If the term number is 2086- Then the calendar year is 2007-08

    Right now I have the expression query built as
    "200" & Mid ([Term],2,2)-1 & "-" & Mid([term],2,2)

    So - if the term is 2096 it extracts 09 from the term and gives me 2008-09

    The problem arised when the term number is 2116
    Now using the above query, it calculates it as 20010-11 instead of 2010-11

    Please direct me.

  2. #2
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    I believe you can handle it using IF ... ELSE to deal with the years before and after 2010, but you just don't like an IF ...ELSE.

    using complicate code is not a good pratice. it is usually much more different to understand, even for youself when you come back after a few months.


    format(Mid(Term,2,2)-1,"2000") & "-" & Mid(term,2,2)

  3. #3
    dduvvuru is offline Novice
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    2
    Thank you so much. It works now.
    Now that you mentioned about If and Else...Yes. I agree it is little bit more steps...but I guess anyone could easily understand if they read it.
    Thanks once again.

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

Similar Threads

  1. Query From Newest Date
    By SSgtJ in forum Queries
    Replies: 2
    Last Post: 01-21-2010, 01:51 PM
  2. Date query
    By Philangr8 in forum Queries
    Replies: 7
    Last Post: 10-06-2009, 04:37 PM
  3. Date Query
    By drako28 in forum Queries
    Replies: 2
    Last Post: 09-10-2009, 11:11 AM
  4. Replies: 2
    Last Post: 07-31-2009, 06:56 AM
  5. Query (Date Question)
    By cillajones in forum Queries
    Replies: 1
    Last Post: 08-09-2008, 12:05 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