Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2006
    Posts
    2

    Trim

    On my Contact Form, I have the following event procedure to create a "FullName" field in my Contact Table:



    Private Sub Suffix_AfterUpdate()
    [FullName] = [Title] & " " & [FirstName] & " " & [MI] & " " & [LastName] & " " & [Suffix]
    End Sub

    If I don't enter a middle initial, I get an extra space in my full name. I am trying to "trim" that field to eliminate the extra space with no luck. I either get the extra space or no space. Any suggestions would be greatly appreciated. I want the "FullName" field in my Contact Table instead of using the =Trim([FirstName] & " " & [MI] & " " & [LastName]) in a report because there are enough instances where we edit slightly the "FullName" field in the table.

    Thanks for your time.

    Julie

  2. #2
    Join Date
    Dec 2005
    Location
    Wilmington, DE - USA
    Posts
    275
    Julie,

    Try:

    [FullName] = Trim([Title] & " " & [FirstName] & " " & IIf(IsNull([MI]), "", [MI] & " ") & [LastName] & " " & [Suffix])

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

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