Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2003
    Posts
    10

    Unanswered: Seperating a field

    Hi everyone. I was wondering if anyone knows how to seperate a field in access? As of now, I have 10 different field in a table. I would like to seperate the field "WHOLE NAME" into three fields:

    LAST NAME
    FIRST NAME
    MIDDLE

    For example -> Smith, Joe K. will be:
    Smith
    Joe
    K.


    Thanks much in advance!

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    can be done if your data is in good shape (meaning that the existing fields are consistently formatted last comma space first space other)

    goes something like this

    Code:
    dim namLast as string
    dim namFirst as string
    dim namOther as string
    
    private sub splitName(longName as string)
      dim hereComma as integer
      dim here2ndSpace as integer
      hereComma = instr(1, ",", longName)
      here2ndSpace = instr(hereComma + 2, " ", longname)
      namLast = Left$(longName, hereComma -1)
      namFirst = mid$(longName, hereComma +2, here2ndSpace - hereComma +1
      namOther = mid$(longName, here2ndSpace+1)
    end sub
    no guarantee for the +/-1, 2: too many beers!

    izy

  3. #3
    Join Date
    Jul 2003
    Posts
    10
    Is there a way I can do w/ with a simply query in Microsoft Access?

Posting Permissions

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