473,394 Members | 2,048 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,394 software developers and data experts.

Populating Multi-Column Combobox

77
Hi,

Here's another problem that I came up with:

I have a combobox in a form with 2 columns. What I need is the following:

1. The combobox to be cleared on form_load (not only the text, but also the list)
2. The combobox to be populated with two fields in a different database (I'm pulling these two lists using a recordset and the data is ready to be fetched into the combobox)... I'm not sure how to populate the two different columns of the combobox and then how to refer to them?
3. On any change in the records, need to refresh the combobox..

Please let me know if any more inputs are required from me to make it simpler..

Thanks in advance........ :-)
Aug 29 '08 #1
4 4244
hjozinovic
167 100+
Hi,

Here's another problem that I came up with:

I have a combobox in a form with 2 columns. What I need is the following:

1. The combobox to be cleared on form_load (not only the text, but also the list)
2. The combobox to be populated with two fields in a different database (I'm pulling these two lists using a recordset and the data is ready to be fetched into the combobox)... I'm not sure how to populate the two different columns of the combobox and then how to refer to them?
3. On any change in the records, need to refresh the combobox..

Please let me know if any more inputs are required from me to make it simpler..

Thanks in advance........ :-)
1. To clear the combobox and the list in it, put a code like this in OnLoad event of the form:
Expand|Select|Wrap|Line Numbers
  1. Me!cboYourCombo = Null
  2. Me!cboYourCombo.RowSource = ""
2. This concerns me a little regarding two 'separate lists' but I hope you know how to get the query showing the list you need to have in your combo box.
If I assume you have that query created and it's name is qryMyList then put a code like this in the event you want to trigger the population of your combobox:
Expand|Select|Wrap|Line Numbers
  1. Me!cboYourCombo.RowSource = "qryMyList"
To reffer to columns of your drop-down list use this code:
Expand|Select|Wrap|Line Numbers
  1. Me!cboYourCombo.Column(Index)
Index is a number ranging between 0 (first column) and total number of columns in the list-1. Columns are indexed starting with zero.
If you have three columns then indexes are 0,1,2
3. In the event afterUpdate of your 'records' put a code like this:
Expand|Select|Wrap|Line Numbers
  1. Me!cboYourCombo.requery
Aug 29 '08 #2
yaaara
77
Thanks for the detailed explaination buddy..

However, when I follow the tip in point 2, I get an error "type mismatch"

Apparantly, trying to pass the recordset directly as recordsource is producing this error... Any clues?

Thanks.
Aug 29 '08 #3
NeoPa
32,556 Expert Mod 16PB
A Recordset cannot be used to populate the ComboBox directly (except in a slow and painful way).

Use the name of a QueryDef or even some SQL for this.

Show the code you're using if you don't think this is your problem, but I suspect it is.

Why do you want to load the data up piecemeal as you describe from your Recordset?
Aug 29 '08 #4
yaaara
77
I think I figured this out..

Instead of passing the recordset directly, I stored it as a string and then passed the string... Works like a jiffy...

Thanks for the assistance all... Highly appreciated :-)
Aug 29 '08 #5

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

Similar topics

2
by: enigma261 | last post by:
Hi, I am a XML beginner. I need some guidance in intrepreting a XML file and then populating my object model. Following is an example of the XML file .. <Tom> <Version>x.0</Version>
2
by: Janus | last post by:
Hello. I need a little advice for populating the treeview control. I dont want my application to hang while populating the treeview, there is a lot of data what's the best approach? Maybe...
1
by: msnews.microsoft.com | last post by:
I'd like to hear your thoughts on best methods for populating drop down list controls. I have states and countries drop down lists that don't change often, so naturally I "hard code" them in the...
4
by: sck10 | last post by:
Hello, I have two dropdown objects that I want to use the same datasource for each. I tried the following, but it doesn't populate the second dropdown. Do I need to close the OleDbDataReader...
5
by: | last post by:
Trying to learn about manipulating collections of objects, and populating these objects dynamically from datasources. Could someone post a code sample that shows the following: Instantiating a...
8
MattFitzgerald
by: MattFitzgerald | last post by:
Please Help! I have a form in this form I have a list box , I have set the property of Multi Select to Extended I also have a query in this query I have a field on which I wish to filter...
1
by: dkohel | last post by:
I have 2 list boxes on my form. I am trying to populate listbox B with the selection from listbox A. I have set multi-select in both boxes to Extended... The user will select the items from...
3
by: Brock | last post by:
I am trying to populate a Crystal Report from data in my DataGrid. The reason for this is that I want the user to be able to change values without updating the database, but still have their...
6
rezme
by: rezme | last post by:
Allow me to preface this with a disclaimer: I'm self taught in C#, basically I type code in from what I've found on the web, and try to get it to do what I want it to. I'm sure there's a lot of us...
0
by: Eric B. | last post by:
I am populating a DataGrid with many rows. As it is populating I see the scrollbar flying but no rows pop up until it is finished. Is there a way to make each row draw as soon as it is...
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.