Results 1 to 10 of 10
  1. #1
    Mahendra1000 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2013
    Posts
    101

    How to categorize Quarters based on Start Date and End Date

    Hello Friends,

    Am struck with a problem in my project. Kindly help me out how to sort it out.

    I have a DB with Start Date (dd.mm.yyyy), End Date (dd.mm.yyyy) and Quarters. We have 4 Quarters (Jan-March, April-June, July-Sep, Oct-Dec) and extra columns of month (xxx) and year (yyyy) too.

    The problem is the front end users have access permissions to modify the dates. if they change the start date and end date then they are manually gonna change other fields like quarter, month and year too (Which they don't want). The users don't need to manually update the column values for Quarter, Month and Year

    For Example,

    If the user modifies Start Date to: 22.05.2014 and End Date to: 24.06.2014 (then the quarter column should be fixed to 2nd quarter and month should be June and year should be 2014).

    2nd Example: We need to consider the End Date for classifying the quarters, Month and Year

    If the Start Date is: 22.05.2014 and End Date is: 24.12.2014 (then the quarter column should be fixed to 4th quarter and month should be December and year should be 2014).



    The solution is when ever the front end user modifies the dates then automatically the quarter, month and year columns need to be changed.

    Could any one send me the sample piece of Access data sheet with just 3 examples. Column names Start date, End date, Quarter, Month, Year.

    i will see the logic and will sort it out.

    Please help me out

  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,965
    Quarter, month, year should not be saved into table. They should be calculated in query 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.

  3. #3
    Mahendra1000 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2013
    Posts
    101
    Hello June7,

    Thanks for the Reply.

    Could you kindly send me a sample demo with just 3 examples please.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,965
    Demo of what? A query with calculations? Don't you already know how to build query with calculated fields?
    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.

  5. #5
    Mahendra1000 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2013
    Posts
    101
    A demo of sample sheet with 3 examples with Start Date, End Date, Quarter, Month and Year fields

    To be genuine am an novice to MS Access and I work in another domain of database. The person who did it is in a long vacation and I have been assigned to this changes.

    I don't know how to build queries with calculated fields. Please assist me

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,965
    Search Access Help and web. Any introductory book on Access will have info. Lots of guidance out there.

    Bing: Access query calculated field

    http://ms-access-tips.blogspot.com/2...n-queries.html

    Use functions to extract date parts.

    Month([End Date])

    Year([End Date])

    DatePart("q", [End Date])
    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.

  7. #7
    Mahendra1000 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2013
    Posts
    101
    Hello June7,

    Thanks for the suggestions. I worked on the month part and it worked.. I used the below formula

    MonthName(Month([EndDate]])

    For year

    Year([End Date]) is not working. Could you let me know the exact formala for finding out the year and quarter

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,965
    That is correct expression for extracting year. What does 'not working' mean - error message, wrong results, nothing happens?

    Use DatePart function for the quarter as already suggested.

    http://www.techonthenet.com/access/functions/index.php

    http://www.quepublishing.com/article...43872&seqNum=3
    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.

  9. #9
    Mahendra1000 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2013
    Posts
    101
    It displaying the values in the year and quarter column as

    #Name?

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,965
    It is not finding the field named [End Date]. Is there actually a space in the name? You don't show a space in the month expression. Make sure spelling is correct.
    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: 2
    Last Post: 10-27-2014, 04:54 PM
  2. Replies: 12
    Last Post: 01-23-2014, 03:24 PM
  3. Convert a date into quarters
    By adray13 in forum Queries
    Replies: 1
    Last Post: 12-05-2012, 11:22 AM
  4. Replies: 15
    Last Post: 04-06-2012, 10:57 AM
  5. Replies: 1
    Last Post: 07-07-2010, 04:22 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