Re: adding values from option groups
- From: Bob Quintal <rquintal@xxxxxxxxxxxxx>
- Date: Sat, 04 Oct 2008 07:41:17 -0400
"Al Campagna" <newsgroups@xxxxxxxxxxx> wrote in
news:uSBSwMdJJHA.1304@xxxxxxxxxxxxxxxxxxxx:
"Bob Quintal" <rquintal@xxxxxxxxxxxxx> wrote in message
news:Xns9B2CCAFF6B654BQuintal@xxxxxxxxxxxxxxx
"Al Campagna" <newsgroups@xxxxxxxxxxx> wrote in
news:eei4lwYJJHA.1308@xxxxxxxxxxxxxxxxxxxx:
Steve,
I may have misunderstood your question. I thought you
wanted to
concatenate the two values. I see now that you want the sum.
(use your own names)
= Opt1 + Opt2 ... should do it.
Describe your names and table definitions for these option
boxes. I'm assuming the two options are "option groups" with
multiple possible
values in each group, and that you have numeric values assigned
to each option within the group.
I find that the fact that you say you can subtract,
multiply, and
divide, but not add the 2 values, very strange...
Al and steve,
What you are seeing here is because the + operator in access has
two roles, one that adds numbers, the other that concatenates
strings.
If Access misinterprets a number as a string, it will
concatenate, not add. The -, / and * operators are not dual
purpose so do not suffer the same confusion.
steve,
somewhere one of your opt values is being interpreted as a
string. Force the conversion to numbers using the val() or cint()
functions, like this: = cint(Opt1) + cint(Opt2)
Thanks Bob. Odd that I've never had to use that function.
with a string, + concatenates the strings if neither is null. The
other concatenation operator, &, concatenates an empty string if one
of the values is null.
But... I may not have ever had cause to add option group values.The original poster, steve, has bound an option group to a string
Also, I tested two option groups on a sample form, and
= [Opt1] + [Opt2]
gave me the correct sum. Hmmm...
field, defined one of the option values as "3" instead of 3, or has
passed the option groups' value to a string variable.
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html
"Find a job that you love... and you'll never work a day in
your life."
--
Bob Quintal
PA is y I've altered my email address.
** Posted from http://www.teranews.com **
.
- Follow-Ups:
- Re: adding values from option groups
- From: Al Campagna
- Re: adding values from option groups
- References:
- adding values from option groups
- From: Steve
- Re: adding values from option groups
- From: Al Campagna
- Re: adding values from option groups
- From: Steve
- Re: adding values from option groups
- From: Al Campagna
- Re: adding values from option groups
- From: Bob Quintal
- Re: adding values from option groups
- From: Al Campagna
- adding values from option groups
- Prev by Date: Proper using of Combobox
- Next by Date: Re: Cascading Combo boxes using CASE command
- Previous by thread: Re: adding values from option groups
- Next by thread: Re: adding values from option groups
- Index(es):
Relevant Pages
|