filtering

Joanna_gr

Board Regular
Joined
Feb 16, 2002
Messages
149
hi all! :rolleyes: I need to create a combo box to select and show all the same values in a column.
For instance I have two columns one with the banks and a second with their addresses.
Sometimes it happens the same bank to have 4 or 5 addresses and in this case there are 4 same entries in the first column. How do I define a tool in a way so each time to select and view only the entries that related to one bank and not all my entries or just one at combo box does. something like filtering if that explains better my request. Thank you very much
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Are you sure that this explanation works in any case? Cause I only get a pop up window asking me to type a parameter value! But I don't want to type it. I want to SELECT it from the 1st combo box. Any ideas what might am I doing wrong? :oops:
 
Upvote 0
The way I would do this is with 2 tables -- Banks and Branches. Banks has, for example, these fields: BankID, BankName. Branches has, for example, BranchID, BankID, BranchName, and other fields with address, phone, manager name, etc.
The 2 tables are related via the BankID field. OK, on the form, you have cmbBank. Control Source is BankID, RowSource has BankID and BankName as the fields. BankID is hidden (the Combo wizard handles this).
cmbBranch has these fields: BranchID (hidden, Control Source), BranchName, Address Details as required, and finally BankID. [Actually, a ListBox may be more flexible for showing all the fields, but the setup is the same].
Now, in Design View on cmbBranch, edit the RowSource (hit the "..." button to display the grid). Go to the BankID field, and in the criteria row, type Forms![MyFormName]![cmbBank] (Change MyFormName to suit). Close and save.
In design view on cmbBank, go to the Events tab. Hit the builder for AfterUpdate, select Code Builder, and in the row after Sub cmbBank_AfterUpdate, type: [cmbBranch].Requery
Close and save.

Now, the first combo will give a list of banks. Once you have made a selection the second combo (or ListBox) will show only branches for the bank that you selected.

HTH
Denis
 
Upvote 0

Forum statistics

Threads
1,221,574
Messages
6,160,602
Members
451,657
Latest member
Ang24

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top