Results 1 to 5 of 5
  1. #1
    RedGoneWILD is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2010
    Posts
    105

    fiscal year

    i have a drop down box with a list of fiscal years. i need a way to take the current date and compare it to the fiscal year range (july 1st-june 30th) and then select the appropriate fiscal year from the drop down box on startup. The drop down box can then be changed to whatever the user wants to view, but i want the current fiscal year to be loaded as default.

    any ideas?

  2. #2
    trb5016 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2009
    Location
    Pennsylvania
    Posts
    71
    There's probably a way to do this using the default property of the combo box but I never have much luck with that.

    What I would do is in the "On Form Open" event put the following code:
    (This assumes that your combo box holds fiscal year as an integer and the "2009/2010" would be stored as 2009 but that can be easily changed)

    Code:
    If Month(Date) < 7 then
               [ComboboxName].Value = Year(Date) - 1
    Else
               [ComboboxName].Value = Year(Date)
    End If
    Last edited by trb5016; 08-04-2010 at 12:53 PM. Reason: Formatting

  3. #3
    RedGoneWILD is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2010
    Posts
    105
    no, the fiscal year is a string like "2009-10" or "2010-11"

    im assuming month(date) returns an integer...so since it's august, that would return 8 correct? and month(date) goes off of the system time right?

    i should be able to figure something out to make it work

    thanks

  4. #4
    trb5016 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2009
    Location
    Pennsylvania
    Posts
    71
    Quote Originally Posted by RedGoneWILD View Post
    no, the fiscal year is a string like "2009-10" or "2010-11"

    im assuming month(date) returns an integer...so since it's august, that would return 8 correct? and month(date) goes off of the system time right?

    i should be able to figure something out to make it work

    thanks
    That's correct, Month() returns an the integer of the month. August would be 8, and Date pulls the date from the system date.

    Adapting my previous code to fit your fiscal year format:

    Code:
    If Month(Date) < 7 then
               [ComboboxName].Value = CStr(Year(Date) - 1) & "-" & Right(Year(Date),2)
    Else
               [ComboboxName].Value = Year(Date) & "-" & Right(CStr(Year(Date)+1),2)
    End If

  5. #5
    RedGoneWILD is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2010
    Posts
    105
    awesome, that works well....thank you!

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

Similar Threads

  1. Replies: 2
    Last Post: 06-30-2010, 12:26 PM
  2. by year by month
    By nkuebelbeck in forum Reports
    Replies: 21
    Last Post: 03-24-2010, 01:53 PM
  3. Use field value as the year in a date
    By Eveline in forum Queries
    Replies: 1
    Last Post: 03-11-2010, 10:58 AM
  4. Filet Records by Current Year
    By jbarrum in forum Access
    Replies: 6
    Last Post: 11-19-2009, 11:34 AM
  5. Query to extract record of particular year
    By pkg206 in forum Access
    Replies: 2
    Last Post: 11-11-2009, 10:01 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