Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Spilt data into two fields

Discussion in 'Information Technology' started by Paul, Nov 6, 2005.

  1. Paul

    Paul
    Expand Collapse
    Guest

    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

    --
    Paul
     
  2. Loading...


  3. John Vinson

    John Vinson
    Expand Collapse
    Guest

    On Sat, 5 Nov 2005 17:57:02 -0800, "Paul"
    <Paul@discussions.microsoft.com> wrote:

    >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]
     

Share This Page