Field Formatting (zeros)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Fspinelli
    New Member
    • Aug 2010
    • 85

    #1

    Field Formatting (zeros)

    Happy Monday Everyone!

    I have no idea really how to phrase this so I'll do the best I can...

    I have a field named "Strike"

    It needs room for 8 characters (numbers) to that field and here's the weird thing:

    An example: say you have to enter the number 940 in the Strike field. Once entered it should show up on a report or query as "00940000".

    Another example, same thing: say I have to enter the number 1025 in the Strike field...it should show "00102500" as the result.

    And yet another: I enter 24 in the Strike field...it should come up in a query or report like "00002400".

    There has to be two zeros first, the number, then if there is anything left after that number, fill it with a zero.

    Know what I mean?

    Thank you!
  • gnawoncents
    New Member
    • May 2010
    • 214

    #2
    Just to clarify, when you enter 940, do you want 940 or 00940000 to display?

    Comment

    • Mariostg
      Contributor
      • Sep 2010
      • 332

      #3
      So looks like you always pad with two zeros at the front and whatever zeros are required to make the final length of 8 based on the length of the initial number.
      So if you have 11, it would be 00110000?

      Comment

      • Mr Key
        New Member
        • Aug 2010
        • 132

        #4
        Your data is not consistent,
        If 1025 gives 00102500 then 940 should gives 00094000
        and 24 should gives 00002400
        But you said 940 implies to 00940000 this makes your data to be inconsistent. Am I write? or what you have writen is correct? If its correct then its real weird.
        If 1024=00102400
        924=00092400
        24=00002400 then it would be possible to work out. Please clarify more

        Comment

        • OldBirdman
          Contributor
          • Mar 2007
          • 675

          #5
          =Left("00" & [Strike] & "000000", 8)

          Comment

          • Fspinelli
            New Member
            • Aug 2010
            • 85

            #6
            Yes, Mariost - I'm pretty sure you get what I'm trying to ask. I'm still crossing my eyes with the zeros, but there is always two in the front, the number, then followed by how many places are left with zeros. Yes, my regular numbers have some (zero) padding front and back. It just adjusts with whatever number.

            I don't know why they want it to look that way (padded zeros before and after number), but they sign my paycheck and I figure if it can be done I'm going to learn how!

            Thank you - any suggestions/advise/info is greatly appreciated!

            Comment

            • Mariostg
              Contributor
              • Sep 2010
              • 332

              #7
              Fspinelli,
              Hey as long as it meets the requirement, that's what counts. That being said, the solution proposed by OldBirdMan is clean and should certainly do.

              Comment

              • Fspinelli
                New Member
                • Aug 2010
                • 85

                #8
                Thank you (everyone)! I will try OldBirdMan's solution.

                Comment

                Working...