Results 1 to 11 of 11
  1. #1
    Join Date
    Nov 2012
    Posts
    9

    Fiscal Quarters in a query


    Hi, I'm an Access novice. My issue is 2-fold. I have query with one of its field called "Start Date". I need to create parameter query that outputs a specific quarter (Ex Qtr 1, 2, 3, or 4) based on the quarter # entered as well as ask the user to input the year as well...so the query will produce on the QTR and the corresponding year. Hope this makes sense...can you assist pls. ps both parameters uses the "start date" field.

  2. #2
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    Try this:
    Code:
    Select yourtable.yourfield1, yourfield2,......etc
    From Yourtable
    WHERE ((yourtable.StartDate = Year([Enter Year])) and (yourtable.Quarter = [Enter Quarter]));
    I think that you need another field that has the quarter value. Based upon the current information you have supplied I see no other way. This may be a calculated field in your query using a nested IIF statement.

  3. #3
    Join Date
    Nov 2012
    Posts
    9
    Thanks for your insight. I did a bit of research on trying to create a field that would determine the "quarter value" and I came up with this (which of course is flawed) Can you help me troubleshoot?

    Quarter: IIf(Month([Start Date]) In (1,2,3),"1",IIf(Month([Start Date]) In (4,5,6),"2",IIf(Month([Start Date]) In (7,8,9),"3",IIf(Month([Start Date]) In (10,11,12),"4")))]
    I've attached a snapshot of the qry I'm working with...many thanks in advance.
    Click image for larger version. 

Name:	QRY.jpg 
Views:	12 
Size:	70.5 KB 
ID:	10244


  4. #4
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    I think that you would be better served using "Or" instead.

    =iif(Month([Start Date]= 1 or Month([Start Date]=2 or Month([Start Date]=3, "1",iif(Month([Start Date]=4 or Month([Start Date]=5 etc..........

    Alan

  5. #5
    Join Date
    Nov 2012
    Posts
    9
    Here's what I have - I'm getting an syntax error.
    =iif(Month([Start Date]= 1 or Month([Start Date]=2 or Month([Start Date]=3, "1",iif(Month([Start Date]=4 or Month([Start Date]=5, Month([Start Date]=6 “2” ,iif(Month([Start Date]= 7 or Month([Start Date]=8 or Month([Start Date]=9, "3",iif(Month([Start Date]= 10 or Month([Start Date]=11 or Month([Start Date]=12, "4")))

  6. #6
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    Here's what I have - I'm getting an syntax error.
    =iif(Month([Start Date]= 1 or Month([Start Date]=2 or Month([Start Date]=3, "1",iif(Month([Start Date]=4 or Month([Start Date]=5, Month([Start Date]
    =6, “2” ,iif(Month([Start Date]= 7 or Month([Start Date]=8 or Month([Start Date]=9, "3",iif(Month([Start Date]= 10 or Month([Start Date]=11 or Month([Start Date]=12, "4")))


    Need a comma after the 6. I have highlighted in Blue.

  7. #7
    Join Date
    Nov 2012
    Posts
    9
    Alan, Sorry to me a pest...i'm still having difficulty...Here's what i'm doing:

    I've added 2 columns to the query (attached in the previous thread).

    In the first column under "field" I have the following:
    Select Events.Start Date, From EventsWHERE ((Events.StartDate = Year([Enter Year])) and (yourtable.Quarter = [Enter Quarter]));and this in the second column:
    1. Quarter=iif(Month([Start Date]= 1 orMonth([Start Date]=2 or Month([Start Date]=3, "1",iif(Month([StartDate]=4 or Month([Start Date]=5, Month([Start Date]=6, “2” ,iif(Month([StartDate]= 7 or Month([Start Date]=8 or Month([Start Date]=9,"3",iif(Month([Start Date]= 10 or Month([Start Date]=11 orMonth([Start Date]=12, "4")))

    Please please provide some guidance...thanks again!

  8. #8
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    Here is a sample db, that someone else had a similar issue with. Look at Query two as to how I handled it. FYI, Query 1 sums the data by quarter.

    In the criteria for the quarter, you can set which quarters you want as well as which years in the Year field.

    Keep it Simple
    Attached Files Attached Files

  9. #9
    Join Date
    Nov 2012
    Posts
    9
    Thank you for the DB....it helped...ALOT!! one more thing: I'm using the following YY: Year([Invoice Date]) and QQ: Choose(Month([Start Date]),1,1,1,2,2,2,3,3,3,4,4,4) in the query. My only issue is its outputting every quarter for the year and I only need a specific quarter (this will be inputed by the user as well as the year. I need the year to be displayed as well instead of the #s 0, -1 etc. Thank you sooooo much for hanging with me this...i truely appreciate your assistance.

    Click image for larger version. 

Name:	QTY2.jpg 
Views:	5 
Size:	30.9 KB 
ID:	10260

  10. #10
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    I need the year to be displayed as well instead of the #s 0, -1 etc.

    I don't understand what you are asking. In the field YY, you should be getting the full year. Where is the 0 and -1 coming from. Sounds like a Boolean format, True/False.

  11. #11
    Join Date
    Nov 2012
    Posts
    9
    I figured it out. You have been a tremendous help...Thank you so much!!!!

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

Similar Threads

  1. Replies: 14
    Last Post: 12-06-2012, 01:12 PM
  2. Problem with Fiscal Quarters
    By sk88 in forum Access
    Replies: 5
    Last Post: 08-26-2011, 02:39 PM
  3. July-June Fiscal Year, Not Jan-Dec
    By blazerboy6 in forum Access
    Replies: 2
    Last Post: 04-14-2011, 02:23 PM
  4. fiscal year
    By RedGoneWILD in forum Programming
    Replies: 4
    Last Post: 08-04-2010, 01:38 PM
  5. Replies: 2
    Last Post: 03-31-2010, 05:32 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