Results 1 to 6 of 6
  1. #1
    Cori is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    May 2015
    Posts
    9

    IsError expression producing #Type! error on report

    I have an Iif(isError) formula that normally works great but on a new report I'm getting some results with a #Type! error. I believe I'm getting the error because the second field in my formula is blank but I don't know how to correct my formula.

    My current Formula: =IIf(IsError([BBBM].[Text]),"",[BBBM].[Text] & " (" & Replace([BBBASTMN].[Text],","," or") & ")")

    For example, if BBBM is blank then the normal output for the row is empty and hidden. If BBBM = ITCS and BBBASTMN (a multi-select field) = A352,A216 then the normal output on the report is ITCS (A352 or A216) but if the field BBBASTMN is empty the output should be just ITCS but instead I'm getting #Type!.

    I can't figure out how to adjust the formula to show the first field if the second field is blank. Any assistance is greatly appreciated.



    Thanks,
    Cori

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Text is a reserved word. Should not use reserved words as names.

    Replace() will error if field is null. Could handle possible null with Nz() or Is Null - review http://allenbrowne.com/QueryPerfIssue.html#Nz

    Replace will not work on a multi-value field because the data is not a string. I NEVER use multi-value fields. https://support.office.com/en-us/art...C-6DE9BEBBEC31
    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
    Cori is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    May 2015
    Posts
    9
    June7,

    At this point I can't replace every multi-value field within the database. I'm inheriting a database where hundreds of tables, queries and forms have already been created, I'm just creating the few reports that hadn't been done earlier. So far the replace has been working fine but looking at the first link, do I need to somehow add a nested IsNull with the Replace?

    Thanks so much,
    Cori

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Is the field a multi-value? If so, Replace() will not work because the data is not a string.

    I don't see how it could have 'been working fine' if used on multi-value fields.
    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.

  5. #5
    Cori is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    May 2015
    Posts
    9
    June7,

    Sorry, I may not be using the correct terminology. On previous reports the replace() worked fine as long as there was data in both fields (these two "fields" are lookup from other two tables). If I'm looking at the description correctly, the original table (for the secondary field) has a data type of short text. The main table that pulls these two tables in (and which all queries and therefore reports are based on) uses a lookup that "allows multiple values" and has a data type = number. I've inherited a complex monster that will be used as-is for the near future. Hope this makes sense.

    Thanks.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    That means a multi-value field. Seems you need a better understanding of what they are: https://support.office.com/en-us/art...C-6DE9BEBBEC31

    And then if you still want the descriptive text concatenated with " or " connector, review: http://allenbrowne.com/func-concat.html

    I still don't understand how the Replace function was working before.
    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: 2
    Last Post: 09-16-2014, 09:00 AM
  2. Replies: 3
    Last Post: 07-21-2014, 09:33 AM
  3. Noob question - Producing an expression
    By olkev in forum Forms
    Replies: 4
    Last Post: 05-07-2014, 03:48 PM
  4. Replies: 1
    Last Post: 05-02-2013, 01:29 AM
  5. Replies: 1
    Last Post: 05-11-2012, 10:59 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