Results 1 to 4 of 4
  1. #1
    pj33558 is offline Novice
    Windows 8 Access 2013
    Join Date
    Mar 2014
    Posts
    18

    Three Fields - will NOT be equal -


    I am trying to figure out the best way to accomplish this task/calculation.

    I have five fields. Comm, Comm2, Comm3, %, Amount (Row # is for reference in my example)

    Most often, Comm2 and Comm3 are blank, and never are Comm, Comm2, and Comm3 filled for same row, and Comm will ALWAYS have something in the field.

    What I need is:

    Row 1: easy: amount X % which gives $30 for JP
    Row 2: amount x 1% for Comm2 AND amount x (3% - 1%) which gives $15 for BD and $30 for JP
    Row 3: amount X 1% for Comm3 AND amount x (3% - 1%) which gives $12.50 for GP and $25.00 for JP
    Row 4: same as row 2
    Row 5; FP gets nothing, all % go to JP

    I have tried: IIf(IsNull[Comm2] AND IsNull[Comm3], [Amount]*[%], [Amount]*([%]-.01) AND [Amount]*(.01))

    and I failed miserably

    (have I mentioned I've not done this sort of thing in years?!)

    Thank you for guidance, tips, hints, suggestions!

    Row # Comm Comm2 Comm3 % Amount
    1 JP 3 100
    2 JP BD 3 150
    3 JP GP 3 125
    4 JP SP 3 1000
    5 JP FP 3 200

  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,973
    If Comm2 and Comm3 are mutually exclusive, why not one field? Could the values shown in each field ever be in the other field? Regardless, they both get 1%.

    Why does FP get nothing?

    Calc results shown wrong - 3% of 100 is only 3, not 30, but I think I get the idea.

    Amount * (0.03 - IIf(Comm2 & Nz(Comm3, "FP")="FP", 0, 0.01)) + IIf(Comm2 & Nz(Comm3,"FP")="FP", 0, Amount * 0.01)
    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
    pj33558 is offline Novice
    Windows 8 Access 2013
    Join Date
    Mar 2014
    Posts
    18
    I am linked by ODBC to the GL. Those two fields were set up that way long before my time and unfortunately, can't be changed at this time. I was originally brought into develop a quick and dirty Access tool and was told it was mostly complete.

    HA! Not even close. The original design had to be thrown out, nothing was salvageable.

    FP gets nothing because it is a generic account for when the CEO sells something (he doesn't get commission on sales).

    So the table above with the Comm, Comm2 and Comm3 are linked to an employee table that has the % for each type of sale. The table contains a bunch of other data I use downstream as does payroll.

    The table linked by ODBC pulls the amounts, customers, names, sales types, where sold, quantity, amounts, regions, etc etc etc... I have linked the ODBC table to the Employee table by EMP column.

    When the Emp name shows up in the Comm2 or Comm3 column, all the % are ignored; they are paid only 1%.

    If their name shows up in the Comm column, they are paid by the % listed below.

    For instance the employee table looks like this:

    Emp ID FNLN PCS PDS SSD DDI SSI PSI
    Jane JP JanePage 3% 2.5% 5% 6% 6.2% 10%
    Mitch MP MitchPrior 2% 3% 4.5% 10% 8% 12.5%

  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,973
    I did some edits on my previous post. Make sure you review it again.
    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. Not equal
    By slimjen in forum Queries
    Replies: 3
    Last Post: 04-21-2014, 12:44 PM
  2. Using Is Not Equal To in a query
    By Demerit in forum Queries
    Replies: 2
    Last Post: 12-26-2013, 04:25 AM
  3. Replies: 7
    Last Post: 11-16-2012, 08:13 AM
  4. Replies: 3
    Last Post: 07-03-2012, 04:41 PM
  5. Set Numbers equal to each other
    By ygu3 in forum Access
    Replies: 1
    Last Post: 07-16-2009, 07:34 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