Create 3 separate fields from one

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a table with an item field that can consist of an item #, a sub
assembly item #, and sub-sub assembly item # separated by periods. I need to
break this up into three separate fields. The original field may only have
item #, or it could have item# & sub, or item#, sub & sub_sub. Data examples:

ORIGINAL TABLE
FIELD:ITEM
01
01.01
01.01.01
01.01.02
01.02

NEW TABLE
FIELD: ITEM SUB SUB_SUB
01
01 01
01 01 01
01 01 02
01 02
 
I have a table with an item field that can consist of an item #, a sub
assembly item #, and sub-sub assembly item # separated by periods. I need to
break this up into three separate fields. The original field may only have
item #, or it could have item# & sub, or item#, sub & sub_sub. Data examples:

ORIGINAL TABLE
FIELD:ITEM
01
01.01
01.01.01
01.01.02
01.02

NEW TABLE
FIELD: ITEM SUB SUB_SUB
01
01 01
01 01 01
01 01 02
01 02

select len(field.item)
case 2
newitem = field.item
case 5
newitem = left(field.item,2)
newsub = right(field.item,2)
case 8
newitem = left(field.item,2)
newsub = mid(field.item,4,2)
newsubsub = right(field.item,2)
end select


Ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top