Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2009
    Posts
    2

    Unanswered: Access-Splitting Field

    Hi,

    I have a table having two fields "Tasks" and "Employees". The data contained in both fields as as follows.

    task 02-500.2-AIR EMISSION INV.
    Employees 12345-JAMES, OSBURN

    I want to split the fields as follows:

    Task: 02-500.2 to a new field "Task Number" and all after "-" to a new field "Task Name"

    Employees: 12345 to a new field "Employee Number", James to new field "Employee First name" and Osburn to new field "Employee last name".

    Will greatly appreciate help.

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    You can use Left$(), Right$() and InStr$() to accomplish this task.

    First use InStr() to determine where the dash occurs in your source field. Than use that number to feed both the left$() function to get the employee number and the right$() function to pull the name.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Jul 2009
    Posts
    2
    hi Teddy,

    thank you for the help. I have been able to split the employee's number from the field. how about the task, there are two dashs, one in the task number and other between the task number and the task name. I applied the same logic to this but it separates only the first two numbers ie. 02. I need to separate the whole 02-500.2 as task number.

    thanks

    khalid

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    so did you work out why you only got the leading 02 bit
    did you then go back to the help file and understand what the suggested functions do
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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