Results 1 to 7 of 7
  1. #1
    fuecheefang is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2015
    Posts
    43

    Split configuration names

    I have some configuration names that I need to split:



    example:

    Dervisevic A. [C] need to split into two columns Last Name and First Initial
    Last Name First Initial
    Dervisevic A. [C]

    Also the data is pretty bad, I also have some data in this manner as well that needs to be separated too (there is a period in between last name and first inital:
    O'Brien.N NEW [C]


    Last Name First Initial
    O'Brien N. NEW [C]

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,418
    If these are your variations I would replace all . with spaces, then insert a . for the initial and trim for superfluous spaces. Something like

    LastName:trim(left(replace(myname,"."," "), instr(replace(myname,"."," ")," ")-1))
    FirstInitial:replace(trim(mid(myname,len(trim(left (replace(myname,"."," "), instr(replace(myname,"."," ")," ")-1))))," ",".",1,1)

  3. #3
    fuecheefang is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2015
    Posts
    43
    Quote Originally Posted by Ajax View Post
    If these are your variations I would replace all . with spaces, then insert a . for the initial and trim for superfluous spaces. Something like

    LastName:trim(left(replace(myname,"."," "), instr(replace(myname,"."," ")," ")-1))
    FirstInitial:replace(trim(mid(myname,len(trim(left (replace(myname,"."," "), instr(replace(myname,"."," ")," ")-1))))," ",".",1,1)
    Thanks Ajax I'm still pretty new, can you clarify by providing the full coding? Would it be something like this?

    SELECT OSX.[Configuration Name]

    trim(left(replace(OSX.[Configuration Name],"."," "), instr(replace(OSX.[Configuration Name],"."," ")," ")-1)) as Last Name

    replace(trim(mid(OSX.[Configuration Name],len(trim(left (replace(OSX.[Configuration Name],"."," "), instr(replace(OSX.[Configuration Name],"."," ")," ")-1))))," ",".",1,1) as First Name

    FROM OSX;

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,418
    looks like it. I didn't test the code

  5. #5
    fuecheefang is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2015
    Posts
    43
    Quote Originally Posted by Ajax View Post
    looks like it. I didn't test the code
    thanks Ajax, So close. I need the First initial to cut off the first 2 characters the z. in (z.C.(AP) [C])
    Configuration Name LastName FirstInitial
    Dietz C. (AP) [C] Dietz z.C. (AP) [C]

  6. #6
    fuecheefang is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2015
    Posts
    43
    Quote Originally Posted by fuecheefang View Post
    thanks Ajax, So close. I need the First initial to cut off the first 2 characters the z. in (z.C.(AP) [C])
    Configuration Name LastName FirstInitial
    Dietz C. (AP) [C] Dietz z.C. (AP) [C]
    *****Problem Solved***** Ajax you are awesome!

  7. #7
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,418
    this should be basic stuff for you

    modify to

    Code:
    replace(trim(mid(OSX.[Configuration Name],len(trim(left (replace(OSX.[Configuration Name],"."," "), instr(replace(OSX.[Configuration Name],"."," ")," ")-1))+2))," ",".",1,1) as First Name
    think I have it in the right place

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

Similar Threads

  1. Replies: 1
    Last Post: 10-08-2015, 03:22 PM
  2. Replies: 3
    Last Post: 02-26-2014, 03:21 PM
  3. Replies: 2
    Last Post: 01-28-2014, 12:04 PM
  4. Replies: 2
    Last Post: 10-18-2012, 06:56 PM
  5. configuration failed
    By PURAN in forum Access
    Replies: 1
    Last Post: 05-15-2012, 03:39 PM

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