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

Passing multiple selections from a column to a combobox or list box

3
Hello, I have a question about making multiple selection queries in Access. I am running windows XP and Access 2003. Up until this point I had a form where a user would make single selections from a combo box and the following combo box would filter based on the initial selection. I now would like to give the opportunity to make multiple selections and the following combo box would filter based on that. How do I go about declaring this variable and passing the selections onto the next column?

Thank you,
Mar 27 '07 #1
4 2846
ADezii
8,834 Expert 8TB
Hello, I have a question about making multiple selection queries in Access. I am running windows XP and Access 2003. Up until this point I had a form where a user would make single selections from a combo box and the following combo box would filter based on the initial selection. I now would like to give the opportunity to make multiple selections and the following combo box would filter based on that. How do I go about declaring this variable and passing the selections onto the next column?

Thank you,
__1. You cannot make multiple selections from a Combo Box - you must use a List Box.
__2. I'll assume that it is a single column List Box, and that you want to make multiple selections from choices made within it.
__3. For demo purposes, we'll name the List Box lstTest.
__4. Set the Multi Select Property of the List Box to Extended. This will enable you to use both CTRL and SHIFT in your selections.
__5. To retrieve all Selected Items from lstTest and build your Criteria String:
Expand|Select|Wrap|Line Numbers
  1. Dim ctl As Control, varItm As Variant
  2.  
  3. Set ctl = Me![lstTest]
  4.  
  5. For Each varItm In ctl.ItemsSelected
  6.   Debug.Print ctl.ItemData(varItm)
  7. Next varItm
Mar 27 '07 #2
tbayse
3
Thank you for you reply and the code. I realized that combo boxes would no pass a multiple selection and have switched to a list box. In the code after I make a selection do I update the After Update event procedure with your code? Currently I have the code ...

Private Sub List81_AfterUpdate()
Me.Combo83 = Null
Me.Combo83.Requery
Me.Combo83 = Me.Combo83.ItemData(0)
End Sub

This code was used on combo boxes to pass single selections to the next box. Should I use a union of your code and this to perform the same? Thank you for your help.
Mar 28 '07 #3
ADezii
8,834 Expert 8TB
Thank you for you reply and the code. I realized that combo boxes would no pass a multiple selection and have switched to a list box. In the code after I make a selection do I update the After Update event procedure with your code? Currently I have the code ...

Private Sub List81_AfterUpdate()
Me.Combo83 = Null
Me.Combo83.Requery
Me.Combo83 = Me.Combo83.ItemData(0)
End Sub

This code was used on combo boxes to pass single selections to the next box. Should I use a union of your code and this to perform the same? Thank you for your help.
Expand|Select|Wrap|Line Numbers
  1. Dim ctl As Control, varItm As Variant
  2.  
  3. Set ctl = Me![lstTest]
  4.  
  5. Me![Combo83].RowSourceType = "Value List"   'necessary
  6. Me![Combo83].RowSource = vbNullString       'Clear out
  7.  
  8. For Each varItm In ctl.ItemsSelected
  9.    Me![Combo83].AddItem ctl.ItemData(varItm)
  10. Next varItm
Mar 28 '07 #4
tbayse
3
Thank you again for you quick reply. Is there a way to post my access database so you can look at what I'm trying to do? Currently the code you have supplied have changed my row source for the combo box to something other then the query box was supposed to find. The original list box that I am trying to make multiple selections from had a field in it that was related to the following table. With a selection, or multiple selections the combo box that follows was to match that field and display items. For example the original list box was MODEL and the following combo box was ACTIVITY. This was a 1 to many relationship. With selection of a MODEL a MODEL ID was known, this was then matched through the query to ACTIVITY that had that model. I hope this makes sense. If not how can I make it clearer?

Thank you again, you have been a tremendous help so far.

Tim
Mar 29 '07 #5

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

Similar topics

4
by: Therese A. Sorna | last post by:
Hello all... I am using Access 2002, and am trying to find a way for a user to be able to select multiple entries from a drop-down list. I am hoping that given a list as such: a b c d
1
by: Mark | last post by:
My Category and Product tables look like: TblCategory CategoryID Category TblProduct ProductID CategoryID Product
2
by: Jen F. | last post by:
I have inherited a medical database in which there are multiple values stored in a single field (ie. "Current Conditions" field might contain 1-20 different conditions, separated by comma (ie....
1
by: jeffgeorge | last post by:
Trying to create multiple acct reports based on the selection in a list box. I've set the list box for multiple selections, and in the report data source, I have a SQL statement which is reading...
2
by: Craig B. | last post by:
I am relativly new to access 2000 and am having some trouble with a report. I am not sure what I want to do is something I can do in access. I want to be able to choose from a combo box multiple...
5
by: Keith G | last post by:
I am using Visual Studio 2003. In the standard combobox control it would appear that only 1 column of data can be displayed in the list (as stipulated in the DisplayMember property). In VBA it was...
6
by: fstenoughsnoopy | last post by:
I have a customer order database and I need to pull a customers information, ie first name, last name, address, city, state, zip, phone, etc, into the oder table. i don't know how to go about...
0
by: Germaris | last post by:
Hi there! Is it possible to make multiple selections in a ComboBox ? i.e. make n consecutive selections and store them in an array or make n selections in the open list of the CB by using (for...
12
by: micarl | last post by:
How would i print a report based on criteria selected from several Combo Boxes as well as multiple Multi Select List Boxes, that are located on the same form? I can get one Multi List Box, just...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: 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
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...

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.