Solved

Values in a Form

Posted on 2011-03-02
340 Views
I have the following code on 2 buttons in the header and 2 fields in the body of a continous form:

Values in the fields are integer numbers

Private Sub btnDOWN_Click()

PQA_L.Value = PQA_L.Value * 0.95
PQA_H.Value = PQA_H.Value * 0.95

End Sub

Private Sub btnUP_Click()
PQA_L.Value = PQA_L.Value * 1.05
PQA_H.Value = PQA_H.Value * 1.05
End Sub

If I click btn_DOWN multiple times when the value hits 10 it stops decreasing

Also, if I click btn_UP the value does not increase anymore

Can anyone tell me why?

I would like to click btn_DOWN down to 1 and be able to go back up again
0
Question by:fitaliano
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 4
• 2

LVL 74

Expert Comment

ID: 35020722
Basic math.

The lower you go, the smaller the percentage change.
The less noticeable the change.

I bet if you increased the decimal precision you will see this gradual change.
( as rounding begins to plays an ever increasing part in the value displayed)
0

LVL 74

Expert Comment

ID: 35020763
Also note that because of Rounding you may go down so low that going back up may not return you to the Exact previous values...

;-)

JeffCoachman
0

LVL 26

Accepted Solution

Nick67 earned 500 total points
ID: 35028735
And multiplying by .95 and 1.05 are not reverses fo each other
Choose * .95 and /.95 OR
* 1.05 and /1.05 and the buttons will reverse each other effects within the limits of the precision you have chosen for your variables
0

LVL 74

Expert Comment

ID: 35030454
Thanks Nick67,

Will you be answering more questions and become an "Expert" here?

0

LVL 26

Expert Comment

ID: 35031404
@boag2000

I've learned a lot from this site and like to contribute something back when circumstances permit
0

LVL 74

Expert Comment

ID: 35031550
;-)

0

Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Suggested Courses
Course of the Month5 days, 5 hours left to enroll