A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Adding value of ComboA and ComboB then dividing by 2



 
 
Thread Tools Display Modes
  #1  
Old November 6th, 2009, 11:29 PM posted to microsoft.public.access.forms
militarypcs
external usenet poster
 
Posts: 1
Default 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  
Old November 7th, 2009, 01:00 AM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default 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  
Old November 9th, 2009, 08:18 PM posted to microsoft.public.access.forms
Daryl S[_2_]
external usenet poster
 
Posts: 881
Default 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  
Old November 9th, 2009, 09:34 PM posted to microsoft.public.access.forms
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:24 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.