Adding value of ComboA and ComboB then dividing by 2

M

militarypcs

Hello, I have a problem with a database I'm working on. Okay, I'll try to
explain it:
I created a form and it has a drop down with default values of 0,1,2, or 3.
Depending on that value, it puts a value into another combo. ie 0=100%. Now
I have eight values (100%, 88.34%, etc) and what I'm having trouble with is
when I try to have all the values (100, 88.34, etc) entered into yet another
combo with the total of the scores divided by eight. So, Combo1 = 1,
therefore, Combo2 automatically puts in 88.23%. Combo3 takes the values of
Combo2 and divides them giving me a total percentage of all the scores. I
keep getting the Combo's to add together, but it's wrong. It will give me
something like 10088.34. It's adding the 100 and the 88.34 but not totaling
them, it's just putting one on the end of the other one. How can I get it
just to add the total scores and divide leaving me with the correct
percentage? Thanks, Jeff
 
J

John W. Vinson

Hello, I have a problem with a database I'm working on. Okay, I'll try to
explain it:
I created a form and it has a drop down with default values of 0,1,2, or 3.

Um? A combo box ("drop down") can have only one DefaultValue property. I
presume these are the choices?
Depending on that value, it puts a value into another combo. ie 0=100%. Now
I have eight values (100%, 88.34%, etc) and what I'm having trouble with is
when I try to have all the values (100, 88.34, etc) entered into yet another
combo with the total of the scores divided by eight. So, Combo1 = 1,
therefore, Combo2 automatically puts in 88.23%.

Where - what table field or fields - is the data being stored? Forms are
volatile and don't store data; tables are fundamental and do. What's the
recordsource of your form, and what data are you actually storing?
Combo3 takes the values of
Combo2 and divides them giving me a total percentage of all the scores. I
keep getting the Combo's to add together, but it's wrong. It will give me
something like 10088.34. It's adding the 100 and the 88.34 but not totaling
them, it's just putting one on the end of the other one. How can I get it
just to add the total scores and divide leaving me with the correct
percentage? Thanks, Jeff

Use the Val() function to convert the text string in the combo to a number,
and add that. You chose not to post the actual code or expression you're using
so it's harder for the volunteers here to correct the code that we can't see.
 
D

Daryl S

Two possibilities I see. First, are the fields numeric fields or text
fields? If you want to add them together, they need to be numeric (or you
need to convert them to numeric). Second, if they are numeric, are you
adding them or concatenating them? The + operator is for adding, the & is
for concatenating.
 

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