• Create query in vba using checkbox as criteria (2000)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Create query in vba using checkbox as criteria (2000)

    Author
    Topic
    #448357

    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.
    Thanks
    Scott

    Viewing 0 reply threads
    Author
    Replies
    • #1096190

      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.

    Viewing 0 reply threads
    Reply To: Create query in vba using checkbox as criteria (2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: