MultiSelect List Box...

mixedguy

Registered User.
Local time
Yesterday, 21:22
Joined
Jun 12, 2002
Messages
52
Hi,

I need help in creating a multiselect list box to requery/refresh my screen. If you look at the attached file, you'll see two multiselect list boxes at the top. I want to allow the users the option to just select from one of the list box or both of them. However the users desire to acquire their information.

Any help with the code would GREATLY BE APPRECIATED!!! Thanks!
 

Attachments

Having looked at the form, I wonder why they have to be listboxes?
Why not have them as Combos, then when the user selects one or other or both and then hits the REFRESH button the code behind the button checks for one or both combos and produces the filter for the subform.....
The combos can be left blank (null) if not selected which is easily detected.


HTH

Dave Eyley
 
Although you point out a good observation...my users want the capability to select more then one option in the list box to filter on.

Dave Eyley said:
Having looked at the form, I wonder why they have to be listboxes?
Why not have them as Combos, then when the user selects one or other or both and then hits the REFRESH button the code behind the button checks for one or both combos and produces the filter for the subform.....
The combos can be left blank (null) if not selected which is easily detected.


HTH

Dave Eyley
 
Hope this will help.

The multi-select form in the attached zipped access 2000 mdb does what you want I think. The boxes are multi-select, so users could hold the control key down to make multiple selections in each box. These will be "orred" in the resulting query.

The code's a bit messy, but it's been commented, so it should be easy to see which bits you need to rename so as to get things working on the form you've already designed.

Also, it should be relaitvely easy to add additional list boxes that allow the users to query additional fields.
 

Attachments

Thanks...this is pretty close to what I'm looking for. I'll need to do some minor tweaks though...

How did you create the query "multi_select_Qry" reference table "f "....? I thought that a query always needed to reference a table or another query. In your design structure, the query references table/query "f " but I don't see a table/query named "f " ???

Thanks!!!



adam_fleck said:
The multi-select form in the attached zipped access 2000 mdb does what you want I think. The boxes are multi-select, so users could hold the control key down to make multiple selections in each box. These will be "orred" in the resulting query.

The code's a bit messy, but it's been commented, so it should be easy to see which bits you need to rename so as to get things working on the form you've already designed.

Also, it should be relaitvely easy to add additional list boxes that allow the users to query additional fields.
 
Alias...

"f" is being used as an alias for the table "users_Tbl".

If you're designing a query in the normal way, the table is usually referenced by its name.

However, you can change this in the Query design grid by right-clicking the table and choosing "Properties" from the popup menu. The properties box for the table now appears. Using the top line you can change its alias to whatever you like. I changed it to "f" because when you turn to the SQL view of a query, single letter aliases are easier to read.

In View SQL the query looks like this:

SELECT f.*
FROM users_Tbl AS f;


If you're typing the SQL yourself then using aliases can save a fair bit of typing. It also helps keep code lines short.
 

Users who are viewing this thread

Back
Top Bottom