2007 Percent field Issues

M

MuzicK622

We just converted to Office 2007, but my database is 2003 so that
could be my issue. (I don't have the time to convert the db to 2007
and do any clean up at this time.) Here is my problem:

I have a field called "Percent Discount" with a field size set to
Single and no decimal places. On the form, the user types in 10% into
the field (2007 automatically shows the % sign). The next field is an
expression =[Amount]-[Dollar Discount]-[Percent Discount] (The usercan
give a dollar discount or a percent discount depending on theirneeds).
It is only subtracting .1% rather than 10%. How do I get it to both
show 10% for the user and subtract the 10% from the amount?

I did try the following under "afterUpdate" but it displays on the
form as 1000% rather than 10% on the form. That scenario at least gets
me the right total, but I'd like to not scare my users! :)
 
A

Allen Browne

Some alternatives:

1. Since percent means per 100, why not mulitply the next expression by 100:
=[Amount]-[Dollar Discount]-([Percent Discount] * 100)

I'm not sure I understand that expression. I would have expected:
=[Amount] * (1 - (([Dollar Discount] + [Percent Discount]) * 100))

2. Alternatively remove the Percent from the Format property.
You might use Fixed if you want zero decimal places.

3. Alternatively you could add this code:
Enter a value as a percent
at:
http://allenbrowne.com/casu-16.html
This will make Access 2003 behave the same as A2007, and A2007 will still
behave correctly.
 
M

MuzicK622

Some alternatives:

1. Since percent means per 100, why not mulitply the next expression by 100:
    =[Amount]-[Dollar Discount]-([Percent Discount] * 100)

I'm not sure I understand that expression. I would have expected:
    =[Amount] * (1 - (([Dollar Discount] + [Percent Discount]) * 100))

2. Alternatively remove the Percent from the Format property.
You might use Fixed if you want zero decimal places.

3. Alternatively you could add this code:
    Enter a value as a percent
at:
   http://allenbrowne.com/casu-16.html
This will make Access 2003 behave the same as A2007, and A2007 will still
behave correctly.

--
Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.




We just converted to Office 2007, but my database is 2003 so that
could be my issue. (I don't have the time to convert the db to 2007
and do any clean up at this time.) Here is my problem:
I have a field called "Percent Discount" with a field size set to
Single and no decimal places. On the form, the user types in 10% into
the field (2007 automatically shows the % sign). The next field is an
expression =[Amount]-[Dollar Discount]-[Percent Discount] (The usercan
give a dollar discount or a percent discount depending on theirneeds).
It is only subtracting .1% rather than 10%.  How do I get it to both
show 10% for the user and subtract the 10% from the amount?
I did try the following under "afterUpdate" but it displays on the
form as 1000% rather than 10% on the form. That scenario at least gets
me the right total, but I'd like to not scare my users! :)- Hide quoted text -

- Show quoted text -

Thank you for getting back to me!
I actually have already plugged in the "After Update" portion of your
code, however instead of dividing it by 100 I had to multiply. I
entered the module code too, but I don't think it will make a
difference (since 2007 puts the % in for me). The expression works
perfectly now, giving the correct answer. The problem left is that
when I enter 30 into Percent Discount, it automatically changes to
3000%. Is there a way for me to simply change what displays?

I'm pretty green at the true development side of ACCESS, so I greatly
appreciate your patience with my ignorance! :)
 
M

MuzicK622

Some alternatives:
1. Since percent means per 100, why not mulitply the next expression by 100:
    =[Amount]-[Dollar Discount]-([Percent Discount] * 100)
I'm not sure I understand that expression. I would have expected:
    =[Amount] * (1 - (([Dollar Discount] + [Percent Discount]) * 100))
2. Alternatively remove the Percent from the Format property.
You might use Fixed if you want zero decimal places.
3. Alternatively you could add this code:
    Enter a value as a percent
at:
   http://allenbrowne.com/casu-16.html
This will make Access 2003 behave the same as A2007, and A2007 will still
behave correctly.
news:42e0c34a-9b18-4ffd-8c99-d9eb3b1e5159@p25g2000hsf.googlegroups.com...
We just converted to Office 2007, but my database is 2003 so that
could be my issue. (I don't have the time to convert the db to 2007
and do any clean up at this time.) Here is my problem:
I have a field called "Percent Discount" with a field size set to
Single and no decimal places. On the form, the user types in 10% into
the field (2007 automatically shows the % sign). The next field is an
expression =[Amount]-[Dollar Discount]-[Percent Discount] (The usercan
give a dollar discount or a percent discount depending on theirneeds).
It is only subtracting .1% rather than 10%.  How do I get it to both
show 10% for the user and subtract the 10% from the amount?
I did try the following under "afterUpdate" but it displays on the
form as 1000% rather than 10% on the form. That scenario at least gets
me the right total, but I'd like to not scare my users! :)- Hide quoted text -
- Show quoted text -

Thank you for getting back to me!
I actually have already plugged in the "After Update" portion of your
code, however instead of dividing it by 100 I had to multiply. I
entered the module code too, but I don't think it will make a
difference (since 2007 puts the % in for me). The expression works
perfectly now, giving the correct answer. The problem left is that
when I enter 30 into Percent Discount, it automatically changes to
3000%. Is there a way for me to simply change what displays?

I'm pretty green at the true development side of ACCESS, so I greatly
appreciate your patience with my ignorance! :)- Hide quoted text -

- Show quoted text -

Also, I tried the first two solutions you posted for an expression,
and both of them gave me 49 as 50% of 100... Could this have something
to do with using the Single Field size?
 
A

Allen Browne

It might be rounding issue. You could try a double rather than a single.
Otherwise it might be something else in your calculations.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

On Feb 25, 8:54 pm, "Allen Browne" <[email protected]> wrote:

Also, I tried the first two solutions you posted for an expression,
and both of them gave me 49 as 50% of 100... Could this have something
to do with using the Single Field size?
 
A

Allen Browne

... The problem left is that when I enter 30 into Percent Discount,
it automatically changes to 3000%. Is there a way for me to
simply change what displays?

No. You need to learn to work the way Access does, not to try to get it to
lie to you about what is really in the control.

30% is not 30.
It is 30/100 = 0.3
 
M

MuzicK622

No. You need to learn to work the way Access does, not to try to get it to
lie to you about what is really in the control.

30% is not 30.
It is 30/100 = 0.3

Trust me I want to do the it right way, I just don't know how! I also
need to make sure that my users know how to enter the figure to make
it work right.
I actually am closer, here's what I have now.
I took out the After Update code as well as removed the module code.
(basically I'm starting from scratch)
I changed the field size to double and changed the expression to
=[Amount]*(1-(([Dollar Discount]+[Percent Discount])*100))
Now I get that 50% (50% is what shows in the box when I type .50) of
100 is (4900.00)

My next step is to go back and remove the percent property and try it
that way, unless you have any other suggestions.
 
M

MuzicK622

No. You need to learn to work the way Access does, not to try to get it to
lie to you about what is really in the control.
30% is not 30.
It is 30/100 = 0.3

Trust me I want to do the it right way, I just don't know how! I also
need to make sure that my users know how to enter the figure to make
it work right.
I actually am closer, here's what I have now.
I took out the After Update code as well as removed the module code.
(basically I'm starting from scratch)
I changed the field size to double and changed the expression to
=[Amount]*(1-(([Dollar Discount]+[Percent Discount])*100))
Now I get that 50% (50% is what shows in the box when I type .50) of
100 is (4900.00)

My next step is to go back and remove the percent property and try it
that way, unless you have any other suggestions.- Hide quoted text -

- Show quoted text -
Once I changed the Format to Fixed, I am getting correct results. To
be honest, I still don't fully understand it. My best point of
reference is Excel where you can format it to percent, type in 50% and
you get 50%. Can you suggest some resources that might explain how and
why Access reads it differently? I'm in a bit of a crunch to finish
this out right now, but I do want to fully understand this before the
next big project.

Thank you for all of your assistance. I do reference your site
frequently for the stuff I do understand and I have learned a lot! I
appreciate you looking out for us newbies!
 
A

Allen Browne

Once I changed the Format to Fixed, I am getting correct results.

That certainly makes sense of what you have been saying.

Your field contains 50 (not 0.5 i.e. not 50%)

I can't see what else you have, but that part certainly makes sense.

In Excel, 50% is 0.5 also.
 

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