Welcome to SPN

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

Sign Up Now!
  1.   Become a Supporter    ::   Make a Contribution   
    Target (Recurring Monthly): $200 :: Achieved: $98

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]
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page