473,387 Members | 1,606 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,387 software developers and data experts.

How to fetch value from multiple combobox in a form ?

66 64KB
I have a form with multiple combo box created during form load, each combo box will have a name starts with "CbErrPM" and series of number.

Say for example if I have to show 3 combo box, my form will be loaded with three combo box with name as CbErrPM1, CbErrPM2 and CbErrPM3.

I am not sure whether all combobox will be present in the form always, sometimes it will be sometimes it will not. But I need value of combobox whenever present and need the value of combobox. Please advise How to proceed.

I tried below but nothing working, please advise how to proceed.


Expand|Select|Wrap|Line Numbers
  1. For k = 1 To Errs
  2. Set FN = Form_frmQCFeedbackCorrection.Controls("CbErrPM" & k)
  3. If FN.Name = "CbErrPM" & k Then
  4. If Forms_frmQCFeedbackCorrection.( & FN & ).Value = "" Then
Expand|Select|Wrap|Line Numbers
  1. If Forms("frmQCFeedbackCorrection").Controls(FN).Value = "" Then
Dec 22 '14 #1
2 1542
twinnyfo
3,653 Expert Mod 2GB
Johny,

I think you may be on the right track, to a certain degree. However, if you know that there will always be only three Errs (or however many), you may simply create your combo boxes and name them CbErrPM1, CbErrPM2 and CbErrPM3.

You then make the combo boxes invisible, but make certain ones visible:

Expand|Select|Wrap|Line Numbers
  1. For k = 1 to 3 (or however many Errs there could be)
  2.     Me("CbErrPM" & k).Visible = False
  3.     Me("CbErrPM" & k).Visible = (Errs >= k)
  4. Next k
Then, to check the values, you would cycle through the actual number of Errs:

Expand|Select|Wrap|Line Numbers
  1. For k = 1 to Errs
  2.     Me("txtValue" & k) = Me("CbErrPM" & k)
  3. Next k
This will also prevent you from trying to find the value of an invisible combo box, which could cause problems.

Hope this hepps!
Dec 23 '14 #2
johny6685
66 64KB
I have around 36 possibilities of getting combo box, and the order may vary, which is why i am creating through code.

I have somehow managed to get the data in the initial stage to verify whether the combo box is updated or not, but now I want to update the values in table.

I used the below code but it is updating only the blank data. Do I need to mention the complete form name. If yes, please advise how to proceed with this code.


Expand|Select|Wrap|Line Numbers
  1. UpdtblEC = "UPDATE tblErrorCorrection SET tblErrorCorrection.[" & ErrPM & "] = CbErrPM" & X & " AND tblErrorCorrection.[CStatus] = 'Correction Completed' WHERE " & whr & ""
Dec 23 '14 #3

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

Similar topics

3
by: greeknl via AccessMonster.com | last post by:
Is possible to save to a variable in VBA the value a combobox had before it was updated in order to use it because the update value can be retrieved easily Thank you -- Message posted via...
8
by: lttan123 | last post by:
hi there i am having some difficulties to bind value to combobox in windows application. combo.Items.Add(new List("a","b")) I have created a class. The value is there but what is displayed...
1
by: Joel1334 | last post by:
Hi! How can I change forecolor of a selected value in combobox? when I select a value in a combobox and press a button to "activate" what I've selected I want the text to be green and then...
0
by: wasim jack | last post by:
sir,I want to change value of combobox of datagridview on the basis of previous combobox value of the same raw of same datagridview
1
by: patel28rajendra | last post by:
I have one table and multiple combobox i want to fill data in these combobox from given table having 2 columns id,name suppose if id==1 then fill name in combobox 1/ plz reply i need urgenty.
7
by: huda89 | last post by:
Hi, Can i perform calculation that fetch value from different table in database? i have two tables which are inbound and outbound table , i need to calculate item in stock,item out and total item....
3
by: Redbeard | last post by:
I am running Access 2010 and have an understanding of VBA Code, but not much coding experience. I would like to know if there is any way of running a Multiple Items Form off a Stander Form. To...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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:
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.