Results 1 to 4 of 4
  1. #1
    jgelpi is offline Novice
    Windows XP Access 2003
    Join Date
    May 2009
    Posts
    19

    Question Truncate text

    I have the following code adding the string word "OUT" at the end of a user's name. I need a way to remove the "OUT" if necessary.

    Code:
     
    If varOutCheck = vbYes Then
            Combo42.Value = Combo42.Value + " OUT"
            Exit Sub
        Else
            BegDayIn.SetFocus
            Combo42.Visible = True
            cboName.Visible = False
            Command48.Visible = True
            Exit Sub
    End If
    I am looking for something to do the following (I know this isn't the correct code, just hope to help you get the idea):



    Code:
     
    If cboName.Value ends in " OUT" Then
            cboName.Value = cboName.Value - " OUT"
    End If
    Thanks for your help!

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    How about something like:
    If Right(Me.cboName,4) = " OUT" Then
    Me.cboName = Left(Me.cboName, Len(Me.cboName)-4)
    End If

  3. #3
    jgelpi is offline Novice
    Windows XP Access 2003
    Join Date
    May 2009
    Posts
    19
    That did it! Thanks a lot RuralGuy!

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You're very welcome.

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

Similar Threads

  1. How to vertically align text inside a text box ?
    By alexcalgary in forum Forms
    Replies: 2
    Last Post: 10-06-2010, 08:44 AM
  2. truncate (?) values
    By ridgeview80 in forum Access
    Replies: 3
    Last Post: 06-02-2009, 02:19 PM
  3. joining text in text boxes
    By jjwilliams73 in forum Forms
    Replies: 1
    Last Post: 08-26-2008, 02:30 PM
  4. Split text field into two text fields
    By Grant in forum Access
    Replies: 6
    Last Post: 01-31-2008, 05:52 AM
  5. Unbound text box truncating text
    By gddrew in forum Forms
    Replies: 0
    Last Post: 03-02-2006, 11:26 AM

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