Add info from another field if present field is empty

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • glat
    New Member
    • Dec 2016
    • 62

    #16
    Phil, sorry got caught up yesterday. Put in the SQL and receiving a message saying "Syntax error in FROM clause".

    Comment

    • glat
      New Member
      • Dec 2016
      • 62

      #17
      I have however put the code in an unbound text box as
      Code:
      =IIf(Not IsNull([TenantRef]),[TenantRef],IIf(Not IsNull([FileListID]),[FileListID],Nz([AdminRef])))
      and it works perfectly.

      I have also used same code in another unbound text box for other fields as well.

      Thank you for all your help.

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32663

        #18
        Originally posted by Glat
        Glat:
        I tried your Nz option however all I kept getting was #Type in my text box.
        I must have missed this earlier.

        I'm confident that using Nz() should both work and give you what you asked for. Can you post your exact attempt at following the suggestion. I suspect we may be able to help you resolve it. One thing to bear in mind using Nz() is that the type of value to use if Null is important in most cases.

        Now I've caught up with the rest of the posts I can see you may not be interested in following up any longer. That's fine, but if you want to see it done with just Nz(), which would be quite sensible, then feel free to continue on.

        I would guess you want something like :
        Code:
        =Nz([TenantRef],Nz([FileListID],Nz([AdminRef],'')))
        If at least one of them is always guaranteed to be non-null then even :
        Code:
        =Nz([TenantRef],Nz([FileListID],[AdminRef]))
        Last edited by NeoPa; Jun 28 '17, 10:08 PM.

        Comment

        • glat
          New Member
          • Dec 2016
          • 62

          #19
          Neopa, somehow I did not receive your last reply. I tried your
          Code:
          =Nz([TenantRef],Nz([FileListID],Nz([AdminRef],'')))
          and this one did work for me as well.

          Thank you.

          Comment

          Working...