Results 1 to 5 of 5
  1. #1
    RazMan is offline Novice
    Windows XP Access 2003
    Join Date
    Apr 2009
    Posts
    2

    Question Need help with IIF function

    I created a purchase requisition in MS Access 2003 and have been racking my brain on how to create an iif statement that would apply tax to a number by clicking a yes/no box. Below is what I'm trying to do:



    If box is checked {Yes} then, tax equals total times 8.375%
    If box is not checked {No} then, tax is zero.

    It seems simple enough but I cant seem to make it work! Any assistance by he community would be greatly appreciated.

    Thanks,

    Raz

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    if the tax number is a text box, easy:
    Code:
    checkbox_on click
    
      if me.checkbox = false then
         me.taxamount=0
      else
         me.taxamount=me.totalfield * .08375
      end if

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Try

    IIf(Taxable= True, AmountField * .08375, 0)

    which using Boolean logic can be shortened to:

    IIf(Taxable, AmountField * .08375, 0)

    In real life, you'd want to get the tax from somewhere rather than having it hardcoded.
    Last edited by pbaldy; 10-28-2010 at 12:07 PM. Reason: fix spelling goof
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    RazMan is offline Novice
    Windows XP Access 2003
    Join Date
    Apr 2009
    Posts
    2
    Quote Originally Posted by pbaldy View Post
    Try

    IIf(Taxable= True, AmountField * .08375, 0)

    which using Boolean logic can be shorted to:

    IIf(Taxable, AmountField * .08375, 0)

    In real life, you'd want to get the tax from somewhere rather than having it hardcoded.
    Thank you VERY MUCH!! This worked perfectly for what I was trying to do.

    Raz

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. if function
    By lolo in forum Queries
    Replies: 1
    Last Post: 08-01-2010, 11:38 PM
  2. Function Help
    By th3spankst3r in forum Programming
    Replies: 12
    Last Post: 03-22-2010, 12:41 PM
  3. Want function to get current function name
    By Davis DeBard in forum Programming
    Replies: 2
    Last Post: 08-13-2009, 05:02 AM
  4. Avg Function
    By hiker8117 in forum Access
    Replies: 3
    Last Post: 04-23-2009, 11:14 PM
  5. Is there a function to do this....
    By Nowherefast in forum Access
    Replies: 2
    Last Post: 12-31-2008, 08:08 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