Results 1 to 6 of 6
  1. #1
    sanmaya is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2014
    Posts
    3

    How to get the Month and year for a date column in query

    i have a situation , that i want a date should show me month.



    i have two dates filed in table that are Due_Date and Close_Date

    my condition would be in query is that a column name Month will show the Month value , if the Due_date is not equal to blank then it will show the Month for Due_date value or it will show the Month of Close_date Value.

    any help with the query will be appriciated.

  2. #2
    burrina's Avatar
    burrina is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Here are a few Examples:
    CurMonth: Format(DateSerial(Year(Date()),Month(Date()),Day(D ate())),"mmmm ")
    CurYear: Year(Now())

    HTH

  3. #3
    sanmaya is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2014
    Posts
    3
    this is not the correct one, i think there should be a if condition with the query. as it "if the Due_date is not equal to blank then it will show the Month for Due_date value or it will show the Month of Close_date Value."

  4. #4
    burrina's Avatar
    burrina is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    What is the value of Blank?

  5. #5
    sanmaya is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2014
    Posts
    3
    Blank means if the Due_Date is NULL then

  6. #6
    burrina's Avatar
    burrina is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Example: Hope this helps.
    CurMonth: IIf(IsNull([Due_Date]),0,[CurMnth])
    CurMnth: Format(DateSerial(Year(Date()),Month(Date()),Day(D ate())),"mmmm ")

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

Similar Threads

  1. Replies: 4
    Last Post: 05-26-2013, 03:28 PM
  2. Year to DATE by Month
    By lugnutmonkey in forum Queries
    Replies: 1
    Last Post: 01-18-2013, 05:37 PM
  3. how to extract month and year from date column
    By penguinwebsoft in forum Queries
    Replies: 5
    Last Post: 10-11-2012, 11:29 PM
  4. month year date
    By slimjen in forum Database Design
    Replies: 6
    Last Post: 04-17-2012, 01:02 PM
  5. Separating a date into day, month and year
    By teirrah1995 in forum Reports
    Replies: 3
    Last Post: 07-17-2011, 02:17 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