473,748 Members | 8,530 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Select Multiple value from Listbox in MS Access

101 New Member
Hi,
My Project is in MS Access.
In that I have one form in which I have some textboxes,combo boxes and listboxes.
Now when I select value from 1st combobox(Custom erID) then it wil generate list for 1st listbox(PalletN o).
Now I want to select miltiple values from that 1st listbox(PalletN o).
and based upon this selection from 1st listbox(PalletN o) and combobox(Custom erID) 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(Custom erID) then it will generate list for 1st Listbox(PalletN o).
like this
CustomerID PalletNo
1000 28300
28302
28303
28306
28307


Now when I select multiple values from that Listbox(PalletN o) 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 5142
PianoMan64
374 Recognized Expert Contributor
Hi,
My Project is in MS Access.
In that I have one form in which I have some textboxes,combo boxes and listboxes.
Now when I select value from 1st combobox(Custom erID) then it wil generate list for 1st listbox(PalletN o).
Now I want to select miltiple values from that 1st listbox(PalletN o).
and based upon this selection from 1st listbox(PalletN o) and combobox(Custom erID) 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(Custom erID) then it will generate list for 1st Listbox(PalletN o).
like this
CustomerID PalletNo
1000 28300
28302
28303
28306
28307


Now when I select multiple values from that Listbox(PalletN o) 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 New Member
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
11264
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 at the top of the list moving down towards the bottom. The problem I was having was that the <select> control was scrolling back to the top of the page after the postback and the user would lose their place in the <select> control forcing them to...
3
4641
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 include the primary key of the parent form of the form that has the listbox. Here is the code that I have. Right now it will put all of the selections from the listbox into one row. Private Sub Category_Click()
3
5627
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 listbox on databind. the problem is this only selects the last row "840" -- i would imagine this
2
2734
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 second one. I seem unable to do this as it only sends back the first item I select whether I have the CTL key down or not. Upon the return trip, I can select another one, but it still only sends value for the last one I selected. -- MY LISTBOX --...
1
3194
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 extract a dataset back. 1.What should i do while passing the multiple selected values 2.Can i use 'in' clause in SQL procedure like eg:Select a.xxx from a where a.yyy in @y
5
4084
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 and listbox are unbound. The listbox rowsource is a value list. The list box has about sixty items in it. Each item in the list box corresponds to a record in the database. When a user selects a row in the list box, the record is retrieved. The...
1
4030
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 are not bound, I select from the bottom set and add to the top set which works fine, but now i decide to remove an item from the top set. when i tried to use a remove item code it worked fine, it did delete the item form the list but it added...
17
3135
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 that I am using Allen Browne's multi-select list box for a report as a guide. I should also note that my access skills are not the best so I may need some explaining on certain things. First let me give some background on the database: I have a...
2
6950
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 come across a way to set the listbox value to only 1 at a time, but need multiple toggle buttons to be on their corresponding listbox item values to be selected. Thanks!
0
8989
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8828
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9537
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8241
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4599
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3309
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2213
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.