How can you split data in 1 field (first and last name) into 2 fields (first, last)?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mo Ewing
    New Member
    • Feb 2011
    • 8

    How can you split data in 1 field (first and last name) into 2 fields (first, last)?

    I have a field in my database with people's names. Each field has only one first name but may have more than one last name. The first name is always the first word in the field. I would like to split this field into two fields, first name and last name. Can I construct an action query to do that for me?
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    You can use InStr() to find the position of the first space and then use Mid() to retrieve the first or last name.

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32634

      #3
      That advice is absolutely correct, but as a point worth noting, names are always complicated due to their varying nature. If you have a specific rule about what goes where that is good, but be aware that such a simple rule is generally not going to cover your actual data reliably. This situation is a good example of why it's a good idea to store data elementally (See Database Normalisation and Table structures).

      Comment

      • Mo Ewing
        New Member
        • Feb 2011
        • 8

        #4
        Worked perfectly. Thank you so much!

        Comment

        Working...