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:
-
SELECT CustomerID FROM [TABLENAME] GROUP BY CustomerID
-
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:
-
Private Sub subtxtControl_Change()
-
Me.PalletNo.RowSource = "SELECT ProjectCodeLookup FROM IMG_TLY_XREF_GROUP_LIST WHERE PROJECTPREFIXLOOKUP = '" & Me.subtxtControl.Value & "'"
-
Me.PalletNo.Requery
-
Me.Repaint
-
End Sub
-
replace the Field names and table names with your table names and fields.
Hope that helps,
Joe P.