Results 1 to 5 of 5
  1. #1
    InformaticsNurse is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    May 2016
    Posts
    8

    Query to calculate # of set fees owed

    Good afternoon,

    I am new to Access and I am building a resident and property tracking database for an my HOA to assist our bookkeeper with all of the owners and lots and what they owe. Here's some background, if interested: https://www.accessforums.net/showthread.php?t=59707



    I have a Homeowner table (TMember), a Lot table (TLot), and an Ownership junction table (TOwnershipJunction) which has an OwnershipBegin and OwnershipEnd date fields.

    I have created a query that that counts the number of lots the homeowner is associated to in the Junction Table as long as there is not a date in the OwnershipEnd field. I am trying to create a query that will calculate the number of HOA fees due every month for each owner. Essentially, if you own 1 or 2 lots you pay 1 HOA fee, but if you own 3 lots you pay 2 fees, 4 lots = 3 fees, 5 lots = 4 fees, etc...


    SELECT TMember.LastName, TMember.FirstName, Count(TLot.LotID) AS CountOfLotID
    FROM TMember INNER JOIN (TLot INNER JOIN TOwnershipJunction ON TLot.LotID = TOwnershipJunction.LotID) ON TMember.MemberID = TOwnershipJunction.MemberID
    GROUP BY TMember.LastName, TMember.FirstName, TOwnershipJunction.OwnershipEnd
    HAVING (((TOwnershipJunction.OwnershipEnd) Is Null));


    I'm not sure how to get the next step to work. Basically I want to create FeesOwed: by evaluating [CountofLotID] and if the number is greater than 1, then subtract 1 and multiply the result by 25 (dollars), otherwise multiply by 25.



    Thank you!

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,424
    use the query you have written in another query and the formula would be

    FeesOwedCountofLotID+(countofLotID>1))*25

    countofLotID>1 will return 0 if it is 1 otherwise it will return -1

  3. #3
    InformaticsNurse is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    May 2016
    Posts
    8
    Thank you for the quick reply. When I enter this in Field: in Design View and Run it, I am asked for to enter a parameter value by a small prompt. This is my first calculated field and I am unable to get it to work like tutorials suggest.

    That is a very clever way to calculate the # of fees owed, at least to my MS Excel brain.

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,424
    yeah - don't think it works in excel - you would get a true or false value which can't be evaluated as 0 or -1

    with regards your prompt - what exactly does it say? it suggests you have a typo somewhere

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725
    InformaticsNurse,

    Seems the calculation for the query would be something like this

    Code:
    FeesOwed: Iif(CountOfLotsOwned>2,(CountOfLotsOwned -1)*25,25) 'only for Owners
    We're still talking Access, right.

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

Similar Threads

  1. Replies: 27
    Last Post: 08-14-2015, 05:59 PM
  2. Replies: 4
    Last Post: 05-06-2015, 08:31 PM
  3. Replies: 5
    Last Post: 04-09-2015, 12:55 AM
  4. Late fees based on due date
    By CoachBarker in forum Queries
    Replies: 1
    Last Post: 11-01-2010, 08:31 AM
  5. Programming Adjustable Pricing Fees
    By JDA2005 in forum Programming
    Replies: 2
    Last Post: 07-07-2009, 10:50 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