Results 1 to 5 of 5
  1. #1
    BringTheR41n is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    36

    Setting up Iif statements


    I have set up a query for some tax info, and i want to able to input a number in 1 column and have to query 'grab' information from a currency column. I am able to input the number and have it pull the said currency value but instead of it reading as a currency, it inserts it as a text format, ie: 2 instead of $2.00. Here is the iif statement i have set up for it currentlt...Total 1: IIf([Exemption]="1",[InvoiceTotal],"-"). exemption is the column i want the single number to be and invoice total is the currency column number i want to "Total 1" to show.
    Any help is appreciated.

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    you can't mix text values and numeric values in the same field your formula should be something like

    Total1: iif([Exemption] = "1", [InvoiceTotal], 0)

    this assumes exemption is a text field.

  3. #3
    BringTheR41n is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    36
    alright. i did that and it worked. for cosmetic purposes would i be able to input it to where the output is a blank instead of zero? i want to make it as easy as possible to quickly read where the numbers are. i have four Total columns to correspond to 4 different exemptions.

  4. #4
    BringTheR41n is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    36
    i figured it out. thank you for the help tho. i didnt know that "-" was messing it up.

  5. #5
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    yes, you can leave it blank by using NULL instead of 0, just be aware that if you do any other mathematical functions using this value you will have to convert the value to 0 anyway otherwise you may get a 'blank' calculation.

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

Similar Threads

  1. IIF() statements
    By ajetrumpet in forum Tutorials
    Replies: 0
    Last Post: 06-17-2011, 06:51 PM
  2. If statements
    By swagger18 in forum Programming
    Replies: 6
    Last Post: 01-28-2011, 08:13 PM
  3. SQL statements from VBA
    By John Southern in forum Programming
    Replies: 12
    Last Post: 05-16-2010, 01:07 PM
  4. IIF Statements
    By JDA2005 in forum Queries
    Replies: 8
    Last Post: 07-07-2009, 04:24 PM
  5. If statements
    By Ezeecopy in forum Access
    Replies: 0
    Last Post: 03-24-2009, 04:54 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