ComboBox calculatio

  • Thread starter wazza w via AccessMonster.com
  • Start date
W

wazza w via AccessMonster.com

hi

i've got a problem, i just create a combobox which has option for percentages
from 2% till 30%

if i click on 2%, i want to see it like the calculation from textfield which
is 1000 and from combobox 2% (0.02) and the total = 1000 * 0.02 = 20

it's like when you click on combobox , automatically it will make calculation
to the total

and by the way i am using MS Access
so any help?
please...
thank you
 
W

wazza w via AccessMonster.com

if you give me any example such as creating a form to see it

thank you
 
C

Chris B via AccessMonster.com

If I undrerstood you correctly...
Make a third textbox on your form and in its control source place your
equation, should be something like
=[name of text field where you placed the number eg your 1000]*[name of
percent combobox]
HTH


wazza said:
if you give me any example such as creating a form to see it

thank you
[quoted text clipped - 11 lines]
please...
thank you
 
A

Allen Browne

Open the Northwind sample database.
Open the Orders form.
In the subform, the Discount field does what you want.
It's a text box, but a combo would give the same results.

To see how it works, open the Orders Subform in design view.
It's Record Source is the query named Order Details Extended.
That query illustrates how to get Access to do the calculations for you.

The most important part of the process is that you do not store the result
of the calculation in your table. Instead, you get Access to give you the
result as a calculation when you need it, through the query.
 
W

wazza w via AccessMonster.com

thank you guys for your help

yesterday i was trying to do it before i see your answers, i found another
solution for it which is:

from combobox , Properties, and then Event , On Change
you have to type:


Private Sub ComboBox_Change()
Select Case Me.Combobox.ListIndex
Case 0
Me.total.Value = Me.number* 1
Case 1
Me.total.Value = Me.number* 0.004
Case 2
Me.total.Value = Me.number* 0.006
Case 3
Me.total.Value = Me.number* 0.008
Case 4
Me.total.Value = Me.number* 0.01
Case 5
Me.total.Value = Me.Split_Amount * 0.012
Case 6
Me.total.Value = Me.Split_Amount * 0.014
End Select
End Sub


Allen said:
Open the Northwind sample database.
Open the Orders form.
In the subform, the Discount field does what you want.
It's a text box, but a combo would give the same results.

To see how it works, open the Orders Subform in design view.
It's Record Source is the query named Order Details Extended.
That query illustrates how to get Access to do the calculations for you.

The most important part of the process is that you do not store the result
of the calculation in your table. Instead, you get Access to give you the
result as a calculation when you need it, through the query.
if you give me any example such as creating a form to see it
[quoted text clipped - 18 lines]
 
Top