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

Select Multiple value from Listbox in MS Access

101 100+
Hi,
My Project is in MS Access.
In that I have one form in which I have some textboxes,comboboxes and listboxes.
Now when I select value from 1st combobox(CustomerID) then it wil generate list for 1st listbox(PalletNo).
Now I want to select miltiple values from that 1st listbox(PalletNo).
and based upon this selection from 1st listbox(PalletNo) and combobox(CustomerID) I want to generate list for 2nd listbox(PONo).

For example

CustomerID PalletNo PONo
1000 28300 12345
1001 28301 12346
1000 28302 12345
1000 28303 12345
1002 28304 12347
1003 28305 12348
1000 28306 12350
1000 28307 12350

So when I select 1000 from 1st Combobox(CustomerID) then it will generate list for 1st Listbox(PalletNo).
like this
CustomerID PalletNo
1000 28300
28302
28303
28306
28307


Now when I select multiple values from that Listbox(PalletNo) then it will generate list for 2nd listbox(PONo)
like
CustomerID PalletNo PONo
1000 28300 12345
28302 12345
28307 12350


I don't know how to do this.
->how to select multiple values from listbox?
->how can I generate list if I select multiple values from listbox?
Can anyone help me?
Thanks in Advance.
Jan 15 '08 #1
2 5092
PianoMan64
374 Expert 256MB
Hi,
My Project is in MS Access.
In that I have one form in which I have some textboxes,comboboxes and listboxes.
Now when I select value from 1st combobox(CustomerID) then it wil generate list for 1st listbox(PalletNo).
Now I want to select miltiple values from that 1st listbox(PalletNo).
and based upon this selection from 1st listbox(PalletNo) and combobox(CustomerID) I want to generate list for 2nd listbox(PONo).

For example

CustomerID PalletNo PONo
1000 28300 12345
1001 28301 12346
1000 28302 12345
1000 28303 12345
1002 28304 12347
1003 28305 12348
1000 28306 12350
1000 28307 12350

So when I select 1000 from 1st Combobox(CustomerID) then it will generate list for 1st Listbox(PalletNo).
like this
CustomerID PalletNo
1000 28300
28302
28303
28306
28307


Now when I select multiple values from that Listbox(PalletNo) then it will generate list for 2nd listbox(PONo)
like
CustomerID PalletNo PONo
1000 28300 12345
28302 12345
28307 12350


I don't know how to do this.
->how to select multiple values from listbox?
->how can I generate list if I select multiple values from listbox?
Can anyone help me?
Thanks in Advance.
It is very easy to do. just pay very close attention to how this is done.


First you need to have all combinations of possibilities in one table in your database.

that will massively simply things.

then for the first item. you simply create a rowsouce by going into the properties of that combo box and then go to rowsource and then click on the .... button to create your query.

copy and paste this into the rowsource property:

Expand|Select|Wrap|Line Numbers
  1.            SELECT CustomerID FROM [TABLENAME] GROUP BY CustomerID
  2.  
Please make sure to put the name of the table that will have the list of customerID's in to in place of [TABLENAME] this way. it knows what table to look at.

also on the property of the CustomerID Combo box you will need to scroll down to the property On Change event. When that is selected, then you need to select the ... button again and select Code Builder.

Then type the following code:

Expand|Select|Wrap|Line Numbers
  1. Private Sub subtxtControl_Change()
  2.     Me.PalletNo.RowSource = "SELECT ProjectCodeLookup FROM IMG_TLY_XREF_GROUP_LIST WHERE PROJECTPREFIXLOOKUP = '" & Me.subtxtControl.Value & "'"
  3.     Me.PalletNo.Requery
  4.     Me.Repaint
  5. End Sub
  6.  
replace the Field names and table names with your table names and fields.

Hope that helps,

Joe P.
Jan 22 '08 #2
billa856
101 100+
It is very easy to do. just pay very close attention to how this is done.


First you need to have all combinations of possibilities in one table in your database.

that will massively simply things.

then for the first item. you simply create a rowsouce by going into the properties of that combo box and then go to rowsource and then click on the .... button to create your query.

copy and paste this into the rowsource property:

Expand|Select|Wrap|Line Numbers
  1.            SELECT CustomerID FROM [TABLENAME] GROUP BY CustomerID
  2.  
Please make sure to put the name of the table that will have the list of customerID's in to in place of [TABLENAME] this way. it knows what table to look at.

also on the property of the CustomerID Combo box you will need to scroll down to the property On Change event. When that is selected, then you need to select the ... button again and select Code Builder.

Then type the following code:

Expand|Select|Wrap|Line Numbers
  1. Private Sub subtxtControl_Change()
  2.     Me.PalletNo.RowSource = "SELECT ProjectCodeLookup FROM IMG_TLY_XREF_GROUP_LIST WHERE PROJECTPREFIXLOOKUP = '" & Me.subtxtControl.Value & "'"
  3.     Me.PalletNo.Requery
  4.     Me.Repaint
  5. End Sub
  6.  
replace the Field names and table names with your table names and fields.

Hope that helps,

Joe P.
Thanks for ur reply but I already got my answer.
Jan 22 '08 #3

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

Similar topics

4
by: headware | last post by:
I have a <select> control that contains many entries. It allows the user to multi-select a group of them, click a button, and store the selected data in a database. Normally they do this starting...
3
by: google | last post by:
Hello, I am trying to create a listbox that users can select multiple entries on. I want Access to put each on of those selections in a different row on a particular table. This table will also...
3
by: mike | last post by:
How do i do the following: lbCountries.SelectedValue = "826"; lbCountries.SelectedValue = "840"; Basically i've set the selectmode to multiple and want to select multiple values of the...
2
by: DC Gringo | last post by:
I have two listboxes, the first of which is an autopostback=true that allows multiple row selection. When I select multiple values (by holding down CTL) in the first one, it should query the...
1
by: karups | last post by:
Hi, I've got listbox in my .aspx page where the users can make multiple selection. So, Users can select 7 items in listbox, I have to take value from items and pass it to stored procedure to...
5
by: Matthew Wells | last post by:
I have a listbox set to simple multi select. For this example, users only select one item at a time. I have command buttons on the form for First, Previous, Next, Last, New (record). The form...
1
by: Sunray | last post by:
I have a form called the sales form and i have 2 sets of listboxes So what happens is. i add items form the bottom set of list boxes which are bound to a data base to the top set of list boxes which...
17
by: trose178 | last post by:
Good day all, I am working on a multi-select list box for a standard question checklist database and I am running into a syntax error in the code that I cannot seem to correct. I will also note...
2
by: 6afraidbecause789 | last post by:
Hi - Has anyone ever used toggle buttons to select items in a listbox? I'd like to put about 24 toggle buttons on an unbound form that select or deselect items in a multiple select listbox. I've...
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: 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?
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
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.