Spliting Name fields into three distinct fields

Results 1 to 2 of 2

Thread: Spliting Name fields into three distinct fields

  1. #1
    dowdc Guest

    Default Spliting Name fields into three distinct fields

    I got a problem at work where the information I getting is stored in a col called name and it holds first name, lastname, and middle intial. Is there a way to split that field into three col named firstName, LastName, Mi

  2. #2
    Join Date
    Dec 1969

    Default RE: Spliting Name fields into three distinct field

    What do you do if a given person has only one or two names entered, instead of all three??? Or somebody has FOUR names???<BR><BR>&#060;%<BR>...<BR>names = Split( RS("nameField"), " " ) <BR><BR>&#039 initialize all three names<BR>first = ""<BR>middle = ""<BR>last = ""<BR><BR>&#039 how many names given?<BR>Select Case UBound(names)<BR>&nbsp; &nbsp; Case 0 &#039 only one name<BR>&nbsp; &nbsp; &nbsp; &nbsp; last = names(0) &#039 so assume it is last name!<BR>&nbsp; &nbsp; Case 1 &#039 two names<BR>&nbsp; &nbsp; &nbsp; &nbsp; first = names(0) <BR>&nbsp; &nbsp; &nbsp; &nbsp; last = names(1)<BR>&nbsp; &nbsp; Case 2 &#039 three names<BR>&nbsp; &nbsp; &nbsp; &nbsp; first = names(0)<BR>&nbsp; &nbsp; &nbsp; &nbsp; middle = names(1)<BR>&nbsp; &nbsp; &nbsp; &nbsp; last = names(2)<BR>&nbsp; &nbsp; Case Else &#039 more than three!<BR>&nbsp; &nbsp; &nbsp; &nbsp; first = names(0)<BR>&nbsp; &nbsp; &nbsp; &nbsp; last = names( UBound(names) )<BR>&nbsp; &nbsp; &nbsp; &nbsp; &#039 collect all other names as middle name<BR>&nbsp; &nbsp; &nbsp; &nbsp; middle = names(1)<BR>&nbsp; &nbsp; &nbsp; &nbsp; for i = 2 To UBound(names)-1<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; middle = middle & " " & names(i)<BR>&nbsp; &nbsp; &nbsp; &nbsp; next<BR>End Select<BR>%&#062;<BR><BR><BR>

Posting Permissions

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