Help needed working with numbers

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sesling
    New Member
    • Nov 2006
    • 84

    #1

    Help needed working with numbers

    I have a database field that stores 8 and 9 digit values. I need to calculate the sum value using the first 8 digits.

    ex.of stored numbers
    123456781
    234567892
    45678903
    987654321
    calculation should use
    12345678
    23456789
    _4567890
    98765432

    My current query statement takes the first 8 of the 9 digit numbers and it takes all 8 of the eight digit numbers. Left(Account,8) .

    Is there a way to alter the statement so it takes the first 8 digits of the 9 digit numbers and inserts a leading 0 or blank space for the 8 digit numbers?
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #2
    Originally posted by sesling
    I have a database field that stores 8 and 9 digit values. I need to calculate the sum value using the first 8 digits.

    ex.of stored numbers
    123456781
    234567892
    45678903
    987654321
    calculation should use
    12345678
    23456789
    _4567890
    98765432

    My current query statement takes the first 8 of the 9 digit numbers and it takes all 8 of the eight digit numbers. Left(Account,8) .

    Is there a way to alter the statement so it takes the first 8 digits of the 9 digit numbers and inserts a leading 0 or blank space for the 8 digit numbers?
    Format the numbers in the table design as

    000000000

    This will put a leading 0 on all numbers with only 8 digits.

    Mary

    Comment

    • sesling
      New Member
      • Nov 2006
      • 84

      #3
      Originally posted by mmccarthy
      Format the numbers in the table design as

      000000000

      This will put a leading 0 on all numbers with only 8 digits.

      Mary

      Thx for the hint but I cannot change the table design. Other processes in our DB need the 8 and 9 digit numbers. Are there any other options?

      Comment

      • MMcCarthy
        Recognized Expert MVP
        • Aug 2006
        • 14387

        #4
        Originally posted by mmccarthy
        Format the numbers in the table design as

        000000000

        This will put a leading 0 on all numbers with only 8 digits.

        Mary
        Try this ...

        Code:
        Left(Format([Account],"000000000"),8)
        Mary

        Comment

        • sesling
          New Member
          • Nov 2006
          • 84

          #5
          Originally posted by mmccarthy
          Try this ...

          Code:
          Left(Format([Account],"000000000"),8)
          Mary

          GREAT!. That worked. Thank you :)

          Comment

          • MMcCarthy
            Recognized Expert MVP
            • Aug 2006
            • 14387

            #6
            Originally posted by sesling
            GREAT!. That worked. Thank you :)
            You're welcome.

            Comment

            Working...