473,385 Members | 2,274 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How can I calculate combo box selections after update?

I have three diferent combo boxs I want to sum the second column of each combo box after update. I tried to sum the selection on a different text box, but it row them up on the text box. How can you sum the selection of the combo box on a different text box?
Jun 18 '10 #1
9 4575
jimatqsi
1,271 Expert 1GB
I'm sorry but your question is not very clear. But I'll take a whack at it anyway.

Suppose you have 3 text boxes, txtT1, txtT2, txtT3 and 3 combo boxes, cb01, cb02, cb03.

If you want to put a value from the 2nd column of each combo box in the corresponding text box, it would be like this:
Expand|Select|Wrap|Line Numbers
  1. txtT1 = cb01.Column(1)
  2. txtT2 = cb02.Column(1)
  3. txtT3 = cb03.Column(1)
  4.  
If you want to add the 2nd column from all 3 combo boxes and put the value in one text box it could be like this
Expand|Select|Wrap|Line Numbers
  1. txtT1 = cb01.Column(1) + cb02.Column(1) + cb03.Column(1)
  2.  
The first column of a combo box is .Column(0)

Hope this helps.

Jim
Jun 18 '10 #2
I have three combo boxes. I want the total on one single text box
Jun 18 '10 #3
NeoPa
32,556 Expert Mod 16PB
You've posted this same question 3 times already, so I've deleted the other two.

If you want the question answered clearly then you will need to give more than 30 seconds to formulating the question. It needs a clear explanation. Without one we can only guess at what you really mean, which is a bit of a waste of time.

Please read FAQ: Posting Guidelines carefully before posting again.
Jun 20 '10 #4
jimatqsi
1,271 Expert 1GB
@bdominiq
bdominiq, If you look at the second bit of code I posted, you will see that it is doing exactly what you want. It is totaling a column from 3 combo boxes and putting the total into one text box. I have named my text box txtT1, and the combo boxes are cb01, cb02, and cb03.

Jim
Jun 21 '10 #5
@jimatqsi
for some odd reason when I use the following formula,
Expand|Select|Wrap|Line Numbers
  1. =[Combo100].[column](1)+[Combo102].[column](1)+[Combo104].[column](1)+[Combo106].[column](1)+[Combo108].[column](1)
instead of getting the total it just place the value of the combo box in one row, like this 601510000. 60 is the price of the first combo 15 is the second one, and 100 is third and finaly the two zeros are the last tow combo s values. Any idea why it's doing that?
Jun 21 '10 #6
NeoPa
32,556 Expert Mod 16PB
From your post it's hard to tell whether you're completely ignoring the suggestion or you simply don't understand. What you say is so unclear.

Jim's code is in VBA and is a valid assignment. If you are using what you posted as a formula in a field in your query or in a control on your form then I wouldn't expect it to work at all. You say it returns a value, which appears to be what you requested in the first place, if so then why is that not right for you?

I suggested before that you take more care with your posts. It doesn't appear that you have taken that on board. I can only say that such a careless approach is unlikely to get your question answered in a way you seem to need.
Jun 21 '10 #7
FishVal
2,653 Expert 2GB
@bdominiq
It looks like [Combo100].[column](n) returns string value, it should be converted to number via Val() function.

Regards,
Fish
Jun 21 '10 #8
jimatqsi
1,271 Expert 1GB
Yes, it looks like you are getting concatenation of strings. I haven't used Val(), I have to look at that. I would have said
=Cdbl([Combo100].[column](1))+Cdbl([Combo102].[column](1))+cdbl([Combo104].[column](1))+Cdbl([Combo106].[column](1))+Cdbl([Combo108].[column](1))
or use Cint or Clng, depending on the values possible.

I would have expected your code to work. I wonder if this is caused by the formatting you have applied to the combo box objects?

I'm going to go look at Val(). I really appreciate learning more about VB/VBA from others here.

Jim
Jun 21 '10 #9
FishVal
2,653 Expert 2GB
@jimatqsi
You are right Jim.
CDbl, Clng, CInt and the similar functions could be more suitable since they return value of a required type, while Val() returns Double.

By the way, string could be converted to double using the following operations:
"1234" * 1 - returns Double 1234
"1234" + 0 - returns Double 1234
and number could be converted to string using the following operation:
1234 & "" - returns String "1234"
Jun 23 '10 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Bobbak | last post by:
Hello All, I was wondering if it is at all possible to have a single combo box update multiple fields in a single record. For example I have created an Employee Info form, and in that form there's...
6
by: Support4John | last post by:
a2k (9.0.6926) SP-3 Jet 4.0 SP-7 I have a form with combo box field that allows the user to select from the combo box or type in the field value that may or maynot be in the combo box field. ...
1
by: Greg Acuna | last post by:
Is there a way to have new data entered into a combo box update the row source table it is connected to?
1
by: BigJay | last post by:
I am 1. trying to have a combobox used as a selector to display records in a subform. and not sure on how to get selected info into subform.the combo is populated but can not get subform updated...
2
by: db_from_mn | last post by:
I have a combo box in which I've set the DataSource to an instance of an ArrayList. The contents of the ArrayList is managed in a timer control's timer_elapsed event handler. The number of items...
1
by: sunilkeswani | last post by:
Hi How do i make a sub-form open up, if some specific options are chosen in a combo box? I need to make that sub form mandatory to fill, if it pops up. Please advise. Cheers Sunny
10
by: halfbodyguy | last post by:
I am using a continuous form, with a combo box. When I select an entry, then Click somewhere else on the form, the entry updates and the combo box goes blank. I don't want it to update until i tell...
2
by: mscdex | last post by:
I have a server application that accepts file transfers (utilitzing tcplistener) and was wondering how I would efficiently go about determining the calculate transfer rate while I am transferring...
8
by: salad | last post by:
I was wondering how you handle active/inactive elements in a combo box. Let's say you have a combo box to select an employee. Joe Blow has been selected for many record however Joe has left the...
4
by: User | last post by:
Hi people, Excuse if my question is silly, but... i have 2 combo boxes in my project they are binded to fields from same table... one is binded do Code field and another to Description field...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.