Results 1 to 2 of 2
  1. #1
    Join Date
    May 2004
    Posts
    1

    Unhappy Unanswered: Extract substring from a text field

    I need to extract "lastname" on the field Name, i have done this before using substring function but I can't do it anymore. Lastname string is separated by ",". Thanks
    Last edited by tcm122160; 05-25-04 at 01:03. Reason: omitted word

  2. #2
    Join Date
    Nov 2003
    Posts
    1,487
    If the last name is first, then....

    Code:
    Dim LastName As String
    LastName = Left(Me.mytextBox, Instr( Me.myTextBox, "," -1)
    MsgBox LastName

    If the last name is at the end, then....

    Code:
    Dim LastName As String
    LastName = Mid$(Me.mytextBox, Instr( Me.myTextBox, ",") + 2, Len(Me.myTextBox))
    MsgBox LastName


Posting Permissions

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