Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 354
  • Last Modified:

Values in a Form

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
fitaliano
Asked:
fitaliano
  • 4
  • 2
1 Solution
 
Jeffrey CoachmanCommented:
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
 
Jeffrey CoachmanCommented:
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
 
Nick67Commented:
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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
Jeffrey CoachmanCommented:
Thanks Nick67,

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

0
 
Nick67Commented:
@boag2000

I've learned a lot from this site and like to contribute something back when circumstances permit
0
 
Jeffrey CoachmanCommented:
;-)

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now