Results 1 to 2 of 2
  1. #1
    jrub is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2012
    Posts
    4

    Find All Possible Expenses Within Time Frame with Replacements Until End Criteria

    Hi All,



    I am a huge NOOB here, so please bare with me

    I have Query1 which I would like to add a record set called Expenditure Years to.

    Basically, expenditures occur as iterative multiples until a criteria is reached.

    For example, if the item was built in 2000, and has a life expectancy of 5 years, and has a life expectancy adjustment of 2 years (only is applied to first iteration), the multiples would list as below; until the base year+study period sum is reached.

    Example: base year (1990) + study period years (30) = 2020
    Expenditure 1 - Item 1 - 2007
    Expenditure 2 - Item 1 - 2012
    Expenditure 3 - Item 1 - 2017

    it would stop here for Item 1 as 2017 + 5 >= 2020, BUT would continue to Item 2 and do it all over again listing possible expenditures.....

    Expenditure 3 - Item 2 -.....
    and so forth....


    Can anyone come up with a VBA macro that accomplishes this? Any help is sincerely appreciated

    Thank you

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    You want query to retrieve records where base year + study period is < 2020?

    SELECT * FROM tablename WHERE [Base] + GetStudyPeriod(life, adjustment) < 2020;

    GetStudyPeriod would be a custom function called by the query where arguments of life and adjustment are passed to the function. Question is where do life and adjustment come from? Are they fields in the table? Show sample data set.

    OR

    Are you trying to create records? Queries can only show records for data that exists (UNION queries are something of an exception but doesn't apply to your situtation). You would have to write data to a table.
    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. Calculating age during a specific time frame
    By mommaof4kids in forum Reports
    Replies: 1
    Last Post: 09-06-2012, 06:08 PM
  2. find all text string in Criteria at once
    By Jerseynjphillypa in forum Queries
    Replies: 3
    Last Post: 05-15-2012, 12:12 PM
  3. Criteria to find when cells are blank
    By Badvgood in forum Queries
    Replies: 3
    Last Post: 12-06-2011, 06:14 PM
  4. Replies: 0
    Last Post: 04-22-2011, 04:58 AM
  5. Find existing record with multiple criteria
    By TheWedgie in forum Forms
    Replies: 1
    Last Post: 03-25-2009, 10:24 AM

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