Results 1 to 5 of 5
  1. #1
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Sacramento, California, USA
    Posts
    491
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Get rid of Middle Initial (WIN 2000 Acc 97)

    I've tried different variations, but still can't get it.

    I have a file with Last Name, First Name Middle initial. Not everyone has an initial, but the format
    is always Last Name comma (with no space) First Name
    How can I get rid of the Middle Initial (at the end)?

    Jr, Sr and hyphens are included with the Last Name before the comma, so I don't have to worry
    about that scenario.

    Pseudocode I have tried different versions:
    If Right(txtName,2) = " " Then
    Right(txtName,1) = " "
    End if

    Your help is always appreciated.

    Michael

  2. #2
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Sacramento, California, USA
    Posts
    491
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Get rid of Middle Initial (WIN 2000 Acc 97)

    Thank you Hans.

    I did change the semi colons to commas -but once I did that - it worked wonderfully !!

    Thank you very much.... again !!

    Michael

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Get rid of Middle Initial (WIN 2000 Acc 97)

    >> I did change the semi colons to commas

    Sorry about that - forgot about my regional settings again. I will correct my reply.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Get rid of Middle Initial (WIN 2000 Acc 97)

    <P ID="edit" class=small>(Edited by HansV on 29-Oct-03 18:50. Changed semicolons to commas in formulas.)</P>You can use this horrible expression in a query:

    TrimmedName: IIf(InStr(InStr([FullName],",")+1,[FullName]," "),Left([FullName],InStr(InStr([FullName],",")+1,[FullName]," ")-1),[FullName])

    or use the expression with = in front of it in a form or report:

    =IIf(InStr(InStr([txtName],",")+1,[txtName]," "),Left([txtName],InStr(InStr([txtName],",")+1,[txtName]," ")-1),[txtName])

  5. #5
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Sacramento, California, USA
    Posts
    491
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Get rid of Middle Initial (WIN 2000 Acc 97)

    No problem Hans. I was thrilled when I was able to figure it out when the syntax
    error message popped up!! That "horrible expression" you supplied, saved us
    hours !! WOW !
    Thank you again for sharing your knowledge with me/us !!

    Michael

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •