Results 1 to 4 of 4
  1. #1
    rbfarley is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2010
    Posts
    3

    Need Help with TRIM command

    I have four fields (First_Name, MI, Last_Name, Suffix) that I am trying to trim so that they will appear without spaces on a report. When I do a combined string (=RTrim([First_Name])+" "+[MI]+" "+Trim([Last_Name])+" "+[Suffix]) I run into problems when any one of the fields is blank. Nothing will print. As long as all four fields contain data it will print. Problem is that only a few records have data in all four fields.

    When I separate out the fields into four separate controls on the report, I cant get the TRIM function to work and there are spaces between the conrols.

    Any idea? I think I am missing somehting simple here.

    Thanks
    Rob

  2. #2
    mastromb is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2009
    Location
    Plymouth, MN
    Posts
    37
    Your function is erroring out because one of the fields is null. I can't say that I exactly know how to fix it because I have never used the trim function but I believe that is you problem.

  3. #3
    rbfarley is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2010
    Posts
    3

    TRIM command

    I am aware of the null string. I need help dealing with the TRIM command with occasional null strings. Middle Initial is always one character so I don't use the TRIM command with this control, but when I add it to another control with the TRIM command such as First_Name I get a blank result when Middle Initial is not present. Unfortunately, not everyone has a middle initial or a suffix (Jr. Sr. etc.), but I have to include it in the name on this report if it is present.

  4. #4
    rbfarley is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2010
    Posts
    3

    All set.

    I am all set now. Got a reply on a different forum. The key to this problem was to remove the TRIM command and change the operators from '+' to '&". I am not sure why it works, but it works and I am on my way. Thanks for everyone's help.

    Rob

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

Similar Threads

  1. AddFromOutlook run command
    By vappel in forum Programming
    Replies: 0
    Last Post: 12-17-2009, 06:02 PM
  2. Alterations to MsgBox command
    By Robert M in forum Programming
    Replies: 4
    Last Post: 06-30-2009, 02:14 PM
  3. Command Button Help!
    By arthura in forum Programming
    Replies: 3
    Last Post: 06-30-2009, 12:55 PM
  4. COPY DATA and TRIM
    By Ed H in forum Access
    Replies: 1
    Last Post: 01-01-2009, 07:01 AM
  5. Trim
    By JMantei in forum Forms
    Replies: 1
    Last Post: 06-20-2006, 02:06 PM

Tags for this Thread

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