Results 1 to 2 of 2
  1. #1
    Gina Maylone is offline Always learning
    Windows 10 Access 2016
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544

    Remove the last "and" in a concatenated name field

    I think I have done this 100 times, but my think is broken. I have a concatenated name field (Comboname) "Doe, John and Jane Doe".
    Code:
    ComboName: IIf([SpouseLastName] Is Null And Not ([Spouse] Is Null),[LASTNAME] & ", " & [FIRSTNAME] & " and " & [Spouse],[lastName] & ", " & [firstname] & " and " & [spouse] & " " & [SPOUSELASTNAME])
    For those without a spouse, I need to remove the trailing "and", I am using this;


    Code:
    Member: IIf(Right([comboname],8)=' and  , ',Left([comboname],Len([comboname])-8),[comboname])
    Honestly, I don't even know where that function came from, or what the "8's" mean. It is not working. Maybe my comboname needs more work. I don't know. So tired of this database.

    Any thoughts always appreciated.

  2. #2
    Gina Maylone is offline Always learning
    Windows 10 Access 2016
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544
    I got it sorted:
    Code:
    ComboName: IIf([SpouseLastName] Is Null And Not ([Spouse] Is Null),[LASTNAME] & ", " & [FIRSTNAME] & " and " & [spouse] & " " & [LASTNAME],IIf([spouselastname]<>[lastname],[spouselastname] & ", " & [spouse] & " and " & [firstname] & " " & [lastname],[lastname] & " , " & [firstname]))

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

Similar Threads

  1. Replies: 19
    Last Post: 03-09-2017, 09:48 AM
  2. Replies: 4
    Last Post: 05-26-2016, 05:57 AM
  3. Replies: 4
    Last Post: 07-12-2014, 02:02 PM
  4. Replies: 3
    Last Post: 04-22-2013, 06:08 AM
  5. How Do I Remove "Time" from a Datetime Field
    By James Parker in forum Queries
    Replies: 4
    Last Post: 01-06-2012, 03:05 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