Spilt data into two fields

P

Paul

Hello!
In a table (Factory) I have a field (FacNo) in which we have 12 digits
(number). For Example 123456054321 . I created 2 new fields one
called FNo and one AcNo how can I have put first 6 digits like (123456) in
field first field FNo and the last 6 digits (054321) in the 2nd field AcNo.

Thanks for your help
 
J

John Vinson

Hello!
In a table (Factory) I have a field (FacNo) in which we have 12 digits
(number). For Example 123456054321 .

Since a Number/Long Integer field is limited to numbers less than
2147483647, you're in trouble. This is NOT A NUMBER. You're never
going to calculate the average of two factory's FacNo values - this
should be Text. What in fact is the datatype of this field?
I created 2 new fields one
called FNo and one AcNo how can I have put first 6 digits like (123456) in
field first field FNo and the last 6 digits (054321) in the 2nd field AcNo.

Take a look at the functions Left() and Right() in the VBA help:
they'll do exactly this (if FacNo is a Text field). If it is numeric
(a Currency or Decimal field perhaps?) you can use an Update Query
updating AcNo to

Left(Format([FacNo], "000000000000"), 6)

and FNo to

Right(Format([FacNo], "000000000000"), 6)

Just leave off the Format() if the field is already text.

John W. Vinson[MVP]
 

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