Separate data in a field

N

neenmarie

I have part numbers & their operation numbers stored as text as follows:
103-8812-10
105-1235-R
6Y-5565-50
I’d like to separate the actual part number from the operation number which
is the number(s) or letter(s) after the last hyphen. Can someone help me to
write everything to the left of the last hyphen to a field in a query? ie:
103-8812
105-1235
6Y-5565
 
F

fredg

I have part numbers & their operation numbers stored as text as follows:
103-8812-10
105-1235-R
6Y-5565-50
I¢d like to separate the actual part number from the operation number which
is the number(s) or letter(s) after the last hyphen. Can someone help me to
write everything to the left of the last hyphen to a field in a query? ie:
103-8812
105-1235
6Y-5565

Access 2000 or newer?

PartNumber:Left([FullNumber],InStrRev([FullNumber],"-")-1)
 
N

neenmarie

Access 2003:
fredg, you are a genius...worked perfectly. Thank you

fredg said:
I have part numbers & their operation numbers stored as text as follows:
103-8812-10
105-1235-R
6Y-5565-50
Iʼd like to separate the actual part number from the operation number which
is the number(s) or letter(s) after the last hyphen. Can someone help me to
write everything to the left of the last hyphen to a field in a query? ie:
103-8812
105-1235
6Y-5565

Access 2000 or newer?

PartNumber:Left([FullNumber],InStrRev([FullNumber],"-")-1)
 
N

neenmarie

I thought I could take your response understand it well enought to change it
and also put the operation number in an additional field....but, I couldn't
figure it out.
I now need to take the characters after the last hyphen and put them in
their own field: ie
180-5557-R to R
6Y-8119-140 to 140
2778992-14 to 14
Thx so much

fredg said:
I have part numbers & their operation numbers stored as text as follows:
103-8812-10
105-1235-R
6Y-5565-50
Iʼd like to separate the actual part number from the operation number which
is the number(s) or letter(s) after the last hyphen. Can someone help me to
write everything to the left of the last hyphen to a field in a query? ie:
103-8812
105-1235
6Y-5565

Access 2000 or newer?

PartNumber:Left([FullNumber],InStrRev([FullNumber],"-")-1)
 
J

JonoB

I beleive that this should do the trick:

OtherPartNumber: Left([FullNumber],InStr([FullNumber],[PartNumber])+1)

neenmarie said:
I thought I could take your response understand it well enought to change it
and also put the operation number in an additional field....but, I couldn't
figure it out.
I now need to take the characters after the last hyphen and put them in
their own field: ie
180-5557-R to R
6Y-8119-140 to 140
2778992-14 to 14
Thx so much

fredg said:
I have part numbers & their operation numbers stored as text as follows:
103-8812-10
105-1235-R
6Y-5565-50
Iʼd like to separate the actual part number from the operation number which
is the number(s) or letter(s) after the last hyphen. Can someone help me to
write everything to the left of the last hyphen to a field in a query? ie:
103-8812
105-1235
6Y-5565

Access 2000 or newer?

PartNumber:Left([FullNumber],InStrRev([FullNumber],"-")-1)
 
N

neenmarie

PartOp: Right([PartAndOp],InStr([PartAndOp],[PartAndOp])+1)
Items as 180-1450-10 came out fine as 10, but
180-1450-140 came out as 40 instead of 140

I need all characters after the last hyphen or after the first hyphen
starting from the right. There may be one or two hyphens and 1 to 3
characters after the last hyphen. Those last characters are what I need.

[PartAndOp] fields may be as follows:
222588-R (I need the R)
222588-40 (I need the 40)
222588-140 (the 140) etc,
6Y-5889-R
6Y-5889-140
108-5889-R
108-5889-40
108-5889-140

JonoB said:
I beleive that this should do the trick:

OtherPartNumber: Left([FullNumber],InStr([FullNumber],[PartNumber])+1)

neenmarie said:
I thought I could take your response understand it well enought to change it
and also put the operation number in an additional field....but, I couldn't
figure it out.
I now need to take the characters after the last hyphen and put them in
their own field: ie
180-5557-R to R
6Y-8119-140 to 140
2778992-14 to 14
Thx so much

fredg said:
On Thu, 10 May 2007 08:14:05 -0700, neenmarie wrote:

I have part numbers & their operation numbers stored as text as follows:
103-8812-10
105-1235-R
6Y-5565-50
Iʼd like to separate the actual part number from the operation number which
is the number(s) or letter(s) after the last hyphen. Can someone help me to
write everything to the left of the last hyphen to a field in a query? ie:
103-8812
105-1235
6Y-5565

Access 2000 or newer?

PartNumber:Left([FullNumber],InStrRev([FullNumber],"-")-1)
 
M

Michael Gramelspacher

I thought I could take your response understand it well enought to change it
and also put the operation number in an additional field....but, I couldn't
figure it out.
I now need to take the characters after the last hyphen and put them in
their own field: ie
180-5557-R to R
6Y-8119-140 to 140
2778992-14 to 14
Thx so much
?Right("123-123-45", len("123-123-45")-instrRev("123-123-45","-"))
45
 
J

JonoB

Try
OtherPartNumber: Mid([FullNumber],Len([partnumber])+2)

neenmarie said:
PartOp: Right([PartAndOp],InStr([PartAndOp],[PartAndOp])+1)
Items as 180-1450-10 came out fine as 10, but
180-1450-140 came out as 40 instead of 140

I need all characters after the last hyphen or after the first hyphen
starting from the right. There may be one or two hyphens and 1 to 3
characters after the last hyphen. Those last characters are what I need.

[PartAndOp] fields may be as follows:
222588-R (I need the R)
222588-40 (I need the 40)
222588-140 (the 140) etc,
6Y-5889-R
6Y-5889-140
108-5889-R
108-5889-40
108-5889-140

JonoB said:
I beleive that this should do the trick:

OtherPartNumber: Left([FullNumber],InStr([FullNumber],[PartNumber])+1)

neenmarie said:
I thought I could take your response understand it well enought to change it
and also put the operation number in an additional field....but, I couldn't
figure it out.
I now need to take the characters after the last hyphen and put them in
their own field: ie
180-5557-R to R
6Y-8119-140 to 140
2778992-14 to 14
Thx so much

:

On Thu, 10 May 2007 08:14:05 -0700, neenmarie wrote:

I have part numbers & their operation numbers stored as text as follows:
103-8812-10
105-1235-R
6Y-5565-50
Iʼd like to separate the actual part number from the operation number which
is the number(s) or letter(s) after the last hyphen. Can someone help me to
write everything to the left of the last hyphen to a field in a query? ie:
103-8812
105-1235
6Y-5565

Access 2000 or newer?

PartNumber:Left([FullNumber],InStrRev([FullNumber],"-")-1)
 

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

Top