Percent Data Entry in Table?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • MX1

    #1

    Percent Data Entry in Table?

    Hi all,

    I've setup a table with one field that will hold percent values. The type
    is number and the format is percent on the field. When I do data entry
    directly into the field, I have to put in .03 to get 3%. If I just enter 3,
    i get 300%. Is there a way to configure the table to let me type in 3 and
    have it enter as 3%?

    Thanks!


  • Phobos

    #2
    Re: Percent Data Entry in Table?

    The "Format" of the field is just that, formatting.

    A value of 3% will be stored as 0.03 (obviously in binary) despite any
    formatting used on the field.

    Short answer = No

    P


    "MX1" <mx1@mx1.abc> wrote in message
    news:P8zmb.2701 0$HS4.102088@at tbi_s01...[color=blue]
    > Hi all,
    >
    > I've setup a table with one field that will hold percent values. The type
    > is number and the format is percent on the field. When I do data entry
    > directly into the field, I have to put in .03 to get 3%. If I just enter[/color]
    3,[color=blue]
    > i get 300%. Is there a way to configure the table to let me type in 3 and
    > have it enter as 3%?
    >
    > Thanks!
    >
    >[/color]


    Comment

    • Fletcher Arnold

      #3
      Re: Percent Data Entry in Table?

      "MX1" <mx1@mx1.abc> wrote in message
      news:P8zmb.2701 0$HS4.102088@at tbi_s01...[color=blue]
      > Hi all,
      >
      > I've setup a table with one field that will hold percent values. The type
      > is number and the format is percent on the field. When I do data entry
      > directly into the field, I have to put in .03 to get 3%. If I just enter[/color]
      3,[color=blue]
      > i get 300%. Is there a way to configure the table to let me type in 3 and
      > have it enter as 3%?
      >
      > Thanks![/color]


      You might find it easier not to use the percent format - just remove it so
      you store the numbers in the table 100 times bigger. Eg in this case, the
      number would be stored as 3 not 0.03 - just display the percent sign as a
      label on a form or report. Just bear this in mind if you perform any
      calculations on these numbers.

      Fletcher


      Comment

      • Stewart Allen

        #4
        Re: Percent Data Entry in Table?

        Try this in the field's On Exit event, just change the txtMyNum field to the
        name of your field.

        Private Sub txtMynum_Exit(C ancel As Integer)
        If Me!txtMynum > 0.99 And Me.Dirty Then
        Me!txtMynum = Me!txtMynum / 100
        End If
        End Sub

        You could display a message box asking the user if they want to convert the
        number but this would get frustrating for the user.

        Stewart


        "MX1" <mx1@mx1.abc> wrote in message
        news:P8zmb.2701 0$HS4.102088@at tbi_s01...[color=blue]
        > Hi all,
        >
        > I've setup a table with one field that will hold percent values. The type
        > is number and the format is percent on the field. When I do data entry
        > directly into the field, I have to put in .03 to get 3%. If I just enter[/color]
        3,[color=blue]
        > i get 300%. Is there a way to configure the table to let me type in 3 and
        > have it enter as 3%?
        >
        > Thanks!
        >
        >[/color]


        Comment

        • Marc

          #5
          Re: Percent Data Entry in Table?

          "MX1" <mx1@mx1.abc> wrote in message news:<P8zmb.270 10$HS4.102088@a ttbi_s01>...[color=blue]
          > Hi all,
          >
          > I've setup a table with one field that will hold percent values. The type
          > is number and the format is percent on the field. When I do data entry
          > directly into the field, I have to put in .03 to get 3%. If I just enter 3,
          > i get 300%. Is there a way to configure the table to let me type in 3 and
          > have it enter as 3%?
          >
          > Thanks![/color]

          You can enter the percentages as 3%, but you must set the fieldlength
          as single or double precision to get a floating point datatype in
          stead of a scaled integer or decimal datatype. The notation must be
          percentage of course.
          the problem is probably that access rescales the entered number-value
          after converting it to the target-datatype. Because floating-point
          values don't loose their fractional part in this operation 3% will be
          stored as 0,03 and not as 0 because of the integer-conversion /
          rescaling process.

          Marc

          Comment

          Working...