Percent Format: Allow user to type Percent, not decimal?

P

PeteCresswell

Seems like when a field's underlying value is a decimal amount, but
the presentation format on a field in a form is "Percent", the user
still has to type the decimal equivalent of the percent when editing
the field.

e.g. CouponRate=.05437 is shown as "5.437%", but when the user clicks
into the field to type something, they have to type, for instance, ".
04798" to get 4.798 percent to show.

Seems logical from one perspective, but my users don't care for it.

I can think of one way to handle this, using event code, but I'm
wondering if there is a Good-Right-And-Holy Path for doing it.

Maybe some field property...?
 
P

Pat Hartman

This is very annoying behavior which Excel handles gracefully. I add code
in the control's AfterUpdate event to solve the problem.

If Me.SomeField > 1 Then
Me.SomeField = Me.SomeField/100
End If
 
P

PeteCresswell

If Me.SomeField > 1 Then
Me.SomeField = Me.SomeField/100
End If

That's what I had in mind.

But I'm also doing conversion where the back end feeds a work table
that the screen is bound to.... so I multiply the decimal amount in
the back end by 100 to get the percent tb shown to the user.

Maybe I need to fall back to your solutin, though, bc I'm now running
into a format issue.
As long as if have .Format="0.00000", it works fine. But as soon as I
change it to "0.00000%", that annoying behaviour kicks in and the app
renders 4.75 as 475%.

Dunno yet whether the users will insist on having that percent sign
showing... but your solution seems to make that concern moot.....
 
P

Pat Hartman

I select Percent as the format property for the control and leave it at
that. Access will render the value correctly. Adjust the decimal places if
you want to have a fixed number of places. The default is 2 places.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top