Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filter form multiple checkboxes

Status
Not open for further replies.

hockeylvr

Technical User
Nov 26, 2002
140
I have looked through all of the posts in "Forms" and "VBA Coding" for checkboxes and cannot find a relevant one.

I have a form based on a query. The data is identified by "subtype" (SolidInk,OEM, etc) and "status" (Active,Tabled,etc) Right now I am just using macros with command buttons to filter the form on open for the various subtypes.

I want to have one search form with a set of checkboxes for each subtype and another set for each status both allowing for multiple selections i.e. the user wants to see all of the Active and Implemented projects with the subtype of SolidInk, OEM and Contracts.

Is this possible? I like the checkboxes because they look cleaner in my opinion but if my only option is a multi-select list box I'll go that route.

Thanks,

Toni
 
Check Boxes will work fine.
Is the form your data is being viewed in a subform?

If it is what you could do is have your criteria at the top of the main form. After the user enables one of the criteria enable your filter button (Or you could have it update everytime the user clicks a filter option. (After_update or Create your own Sub)

You will have to check each criteria to see if it IsNull or IsEmpty or equal to false, but you can then piece your filter together and requery your subform with the filter.

OR

You can create a form that contains all of your filter criteria and then give the user a command button to open the form with the filtered data.

You have quite a few options.

Let me know if you need anything else.

Ascent
 
Thanks for the fast reply.

My data is on my main form with no subform. Is the 2nd option you gave for this situation?

I am trying to build an strWhere clause for the filter.

Toni
 
Yes, the second option would be what you would use. When the user clicks on <your command button> you will build your strWhere in the OnClick Event.

Your syntax will probably be a little trickey depending on the amount of criteria the user has available to them. Hollar if you need help with that.

Ascent
 
How are ya hockeylvr . . . . .

Multi-Select Listboxes would also do the trick. If screen realestate is a problem, put them on a seperate form. Alot cleaner and easier focused viewing than all those checkboxes.

You can use the mainforms [blue]Filter Properties[/blue] or you can [blue]dynamically[/blue] change the [blue]recordSource[/blue] with query . . .

Calvin.gif
See Ya! . . . . . .
 
Thanks to both of you. I went ahead and used Martin Green's listbox approach and it is working great.


I still want to use the checkbox format someday and will continue to work on it.

Thanks again,

Toni
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top