Results 1 to 9 of 9

Thread: Trim Function

  1. #1
    Join Date
    Aug 2001
    Posts
    7

    Unanswered: Trim Function

    I can use the trim function on a word and a single field, how do I use it to trim 3 fields in a table i.e. [sal] [firstname] [surname] for an address label?

    Or will I have to redesign the table to a single field for [name]

    Any suggestions would be appreciated

    Cheers
    Trudy

  2. #2
    Join Date
    Feb 2004
    Posts
    533
    You can use variables to capture each field and then concatenate them.

    fName = Trim([FirstName])
    lName = Trim([LastName])
    sal = Trim([Solution])

    [txtAddressName] = sal & ". " & fName & " " & lName


    Its a good idea to test your data for the correct format and remove spaces before its entered into the table. You can use field masks or run a validation process on the before insert event.


    ~
    ~

    Bill

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    or
    Code:
    select trim([sal]) & " " & trim([firstname]) & " " & trim([surname]) as fullname from tblBlah

  4. #4
    Join Date
    Aug 2001
    Posts
    7
    Thank you both, I'll give it a try

    Cheers
    Trudy

  5. #5
    Join Date
    Aug 2001
    Posts
    7

    Talking

    It worked perfectly, thank you very very much

    Cheers
    Trudy

  6. #6
    Join Date
    May 2004
    Posts
    159
    Can I use the trim function on a field with just spaces in it?
    I have a number of records that have just spaces in them and I want to delete the spaces to give me an empty field. will trim do that?

  7. #7
    Join Date
    Mar 2005
    Posts
    16
    How do I use the trim function?
    I'm not very good with computers.
    The fields that I want to trim are Title, Forename and Surname. Do I enter them into a text box or a label?

    All help much appreciated.

  8. #8
    Join Date
    Mar 2005
    Posts
    16
    Please, I need help!

  9. #9
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    In a textbox (but not a label), put this in the ControlSource property
    =Trim([SurName])
    Inspiration Through Fermentation

Posting Permissions

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