Results 1 to 3 of 3
  1. #1
    Arnold is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    May 2014
    Posts
    43

    Calculate with IIf [columnA] + [columnB] IIf ColumnB is a number and if "Free" than treat like 0

    Hi


    I have 2 columns
    A- Price
    B- Shipping

    ColumnB can also have the value of "Free" which can't be added.

    How can I write the total Column to query the total for columnA and B and to treat "Free" like a 0?

  2. #2
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    For one thing, you can use the IsNumeric function. http://www.techonthenet.com/access/f.../isnumeric.php

    If either field can be nulls, then you might want to use NZ as well.

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Mixing data types in one field is problematic. Why do this? Make it a number field. Enter 0 (can be default) or leave it Null.

    To calculate a Total column:

    [Price] + IIf([Shipping]="Free", 0, [Shipping])
    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. Replies: 5
    Last Post: 01-04-2017, 02:13 AM
  2. Replies: 1
    Last Post: 09-03-2014, 03:27 AM
  3. Replies: 1
    Last Post: 01-08-2014, 04:43 PM
  4. Replies: 5
    Last Post: 03-22-2013, 01:11 PM
  5. Replies: 21
    Last Post: 06-03-2009, 05:54 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