Results 1 to 2 of 2
2008-02-05, 21:45 #1
- Join Date
- Nov 2001
- Atlanta, Georgia, USA
- Thanked 0 Times in 0 Posts
Create query in vba using checkbox as criteria (2000)
I need help in creating a query that can use checkboxes as part of the parameters.
The table has 156,000 rows of data that have to be chopped down exported to Excel in various ways.
Some of the key fields are Region(North, South, East, West), Type(Commercial, Government), ReadingType(Direct, Internet, Autofax, Customer)
Some of the checkbox groups will be multi-selected Eg. North, East & West might all be selected.
There would be an All checkbox for each type in case they want All of them selected in each group.
What I would like is as the user checks each box a query is built on the fly to be exported.
Also as they are checked I could show a total on the form showing how many records it will export as not to exceed Excel's maximum.
I started playing with the checkboxes on the form and thought about using the type of code Multi-Select listboxes use but since the
checkboxes only return a -1 or 0, I can't figure out how to convert that to the North, South,.... I need to construct the query.
Does this sound feasible? or is there a better way to construct.
I didn't want to use listboxes as some of the categories might have 10 items in them. To me, checkboxes would be easier to see what is selected
without having to scroll up/down in a listbox in case you have to adjust your selections.
2008-02-05, 21:52 #2
- Join Date
- Mar 2002
- Thanked 28 Times in 28 Posts
Re: Create query in vba using checkbox as criteria (2000)
With up to 10 items, a multi-select list box could easily be made tall enough to display all items at once, without scrolling.
If you'd rather stay with check boxes, you can still model your code on that for multi-select list boxes - instead of looping through the items, loop through the check boxes and add something to a "where" string if the check box is ticked.