Multiselect List Box & Query?

Equine Investor

Board Regular
Joined
Nov 20, 2002
Messages
103
Hi guys,

I have a form which has two command buttons.

One command button runs a query which displays the corresponding results in datasheet view.

The other command button runs another query which displays another form displaying calculations.

Both queries get their data from text boxes on the form.

My problem is this:

I have added a multiselect listbox and have followed a tutorial to get it working o.k.

BUT....

Instead of having a separate command button for the multiselect listbox returning results of that query, I want to add the selected items to either of the other two queries. (In other words when I press either command button running my main queries, it incorporates the selections from the listbox).

Does anyone have an idea and can explain it in newbie terms please?
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Thanks for the reply Nate.

I'm not sure that's going to solve the problem though.

I need some way of incorporating the two queries above, not multiple parameters for the same query or field.

I am trying to run the multiselect listbox selections and adding the results as a filter to another query which also has other criteria.

Bit confusing, but I know it can be done, just can't get my head around how to do it.

:oops:
 
Upvote 0
One thought is to create a table and populate it from the list box and join that table in your query. This would limit records in the main query to ones that match the new table. When you you punch the button it would have to clear the records from the table and then append the new values from the list, that could end up slow with a big list, but worth a try.

Peter
 
Upvote 0
Thanks for the suggestion, but my database is over 700Mb and this would slow it down to snailpace.

I heard somewhere that instead of using a multiselect listbox, I could insert a subform and add it to the query requiring little if any coding.

Is this possible and how would I do it?
 
Upvote 0
it should only cause a big slow down if the listbox selection is big not the data itself.

I imagine that using a subform is doing the same thing, adding records to the form would automaticaly write them to the table and this would be easier to create than the list box but probably not as user friendly.

Peter
 
Upvote 0

Forum statistics

Threads
1,221,657
Messages
6,161,084
Members
451,684
Latest member
smllchng5

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