471,321 Members | 1,744 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Calculating ComboBox Columns

26 16bit
Getting the values from a ComboBox's columns works to fill in a TextBox but can't get the results from a calculation in another TextBox. I don't know why I get an #Error in TextBoxes 3-4 unless the value from a column is not a true numeric value but a string value and if so, how can it be converted to a numeric value for calculation?

Here is what I have.
TextBox1 - txtQty (Static quantity from ComboBox column-3)
TextBox2 - txtPicked (Quantity from ComboBox column-4)
TextBox3 - txtActQty ( Calculated - [txtQty]-[Picked])
TextBox4 - txtTarLevel (Stock target quantity from ComboBox column-5)
TextBox5 - txtLoadQty (Calculated - [txtTarLevel] - [txtActQty]

Open to any suggestions.
3 Weeks Ago #1

✓ answered by NeoPa

Curious27:
Why would the "Sum" cause the error?
That is so very hard to answer as you provide no context. I will try.

Sum() works specifically with sets of data. It essentially means (in this case) to calculate [Qty]-[Picked] for one record and add it into a total, then keep making the same calcuulation for each record in the set and repeatedly adding the result into a total value that is passed back as the result. Nowhere do you mention any sort of set of data so my guess is you don't have one - which is why it's confused.

If you do have a set of data to work on then not including that information in the question is very hard to understand.

As for finding your question again once you've posted it, there are two things to bear in mind :
  1. Posts by most users now are being sent directly to the moderation queue rather than forum itself. Moderators, such as myself and others, get notified of this and decide to free it into the forum or delete it depending on the contents. Yours are fine but still have to be moderated first.
  2. I use Subscriptions to find and show me all my subscribed threads. Even with over twelve and a half thousand of them this works for me. Very few stay active for a long time and that link sorts them by recent activity.
NB. The link I provided will take any member to their own set. It's not specific to my account.

3 8950
NeoPa
32,405 Expert Mod 16PB
Curious27:
Getting the values from a ComboBox's columns works to fill in a TextBox but can't get the results from a calculation in another TextBox.
I would say the first, and most obvious, question - or request - is for the actual formulas used.

It's possible to work in the dark but I see no reason why it might make sense.

I wouldn't expect any reference to a ComboBox's .Columns() Method to work outside of a VBA environment.
3 Weeks Ago #2
Curious27
26 16bit
Hi NeoPa

I worked on this for hours, then after posting my question it did not appear and the next day it still wasn't there. I thought I may have exited without actually pressing the button, so I made another post and it to did not appear and I know I press the post button that time.

Any ways I did figure the out the problem which was a calculation error that I place in the Control Source for TextBox 3-5. Since this was my first time using ComboBox Columns to fill in Textbox's I thought the Error I was getting was from the values they were filled with. As I stated I did figure it out and I am still confused as to why the Error. Here is my calculation I placed in the Control Source for TextBox 3-5 which did not work.

Gives #Error:
Expand|Select|Wrap|Line Numbers
  1. =Sum([Qty]-[Picked])
Works:
Expand|Select|Wrap|Line Numbers
  1. =[Qty]-[Picked]
Why would the "Sum" cause the error?
3 Weeks Ago #3
NeoPa
32,405 Expert Mod 16PB
Curious27:
Why would the "Sum" cause the error?
That is so very hard to answer as you provide no context. I will try.

Sum() works specifically with sets of data. It essentially means (in this case) to calculate [Qty]-[Picked] for one record and add it into a total, then keep making the same calcuulation for each record in the set and repeatedly adding the result into a total value that is passed back as the result. Nowhere do you mention any sort of set of data so my guess is you don't have one - which is why it's confused.

If you do have a set of data to work on then not including that information in the question is very hard to understand.

As for finding your question again once you've posted it, there are two things to bear in mind :
  1. Posts by most users now are being sent directly to the moderation queue rather than forum itself. Moderators, such as myself and others, get notified of this and decide to free it into the forum or delete it depending on the contents. Yours are fine but still have to be moderated first.
  2. I use Subscriptions to find and show me all my subscribed threads. Even with over twelve and a half thousand of them this works for me. Very few stay active for a long time and that link sorts them by recent activity.
NB. The link I provided will take any member to their own set. It's not specific to my account.
3 Weeks Ago #4

Post your reply

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

Similar topics

3 posts views Thread by Paul Fairless | last post: by
3 posts views Thread by JAdrianB | last post: by
30 posts views Thread by dbuchanan | last post: by
1 post views Thread by fiaolle | last post: by
4 posts views Thread by =?Utf-8?B?Q2hyaXM=?= | last post: by
reply views Thread by rosydwin | last post: by
reply views Thread by Curious27 | last post: by

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.