Using %, Access 2003 and Access 2007

S

Stapes

Hi

I have in a table a field PROFIT MARGIN, Data Type Number, Field Size
Single, Format Percent, Decimal Places 2.

On the Form that displays it, the Profit Margin field is defined as
Format Percent, Decimal Places 2.

When a value is entered in here, it comes out wrong. i.e. If I type in
39.00%, it redisplays as 3900%

So I added some code:

Profit_Margin = Profit_Margin / 100

That works. Until I run it in Access 2007.

I have to remove the code to make that right.

I am baffled.

Can I find out in code what version the program is running under and
then only run that code when necessary?

Stapes
 
A

Allen Browne

See:
Enter a value as a percent
at:
http://allenbrowne.com/casu-16.html

That code works in any version. It looks for the % sign in the Text of the
control, and divides by 100 only if not found. Access 2007 adds it by
default, so the code does not cause a problem in the new version.
 

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