If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Adding value of ComboA and ComboB then dividing by 2
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 |
#2
|
|||
|
|||
Adding value of ComboA and ComboB then dividing by 2
On Fri, 6 Nov 2009 15:29:01 -0800, militarypcs
wrote: 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. -- John W. Vinson [MVP] |
#3
|
|||
|
|||
Adding value of ComboA and ComboB then dividing by 2
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. -- Daryl S "militarypcs" wrote: 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 |
#4
|
|||
|
|||
Adding value of ComboA and ComboB then dividing by 2
The + operator will concatenate text fields if not converted to numbers.
-- Build a little, test a little. "Daryl S" wrote: 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. -- Daryl S "militarypcs" wrote: 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 |
Thread Tools | |
Display Modes | |
|
|