View Full Version : ad hoc data query from form with check boxes


thatlem
03-05-2010, 10:21 AM
Am wondering if anyone knows of a way to create an ad hoc data query from a form, which also shows check boxes for all fields. Basically, I would like to have the user be able to check the data box for the fields they want to see, then run the query. The query would only display those fields checked.

I am assuming I could build a "super" query with all fields, and then use code in the form to select the fields as visible or not visible based on the check box result, but am not sure how to go about building the code.

Any suggestions? Thanks :p

Brianwarnock
03-05-2010, 10:25 AM
You have also posted this in the Excel forum, please delete that thread.

Why :p

It is possible to o this for a report but Idon't think it is for a query

Brian

vbaInet
03-05-2010, 10:27 AM
You use a continuous form for this and include the checkbox.

Your checkbox must be linked to the record source of your form.

Your form will have a button that will call a function to process all checked.

thatlem
03-05-2010, 10:28 AM
That's what I was afraid of. Can you educate me on the code I would need to run this in a report.

Thanks

Brianwarnock
03-05-2010, 10:45 AM
Although I said that you can do it, I wouldn't.
The way it works is that you make the controls visible or invisible, so they are always there and thus taking up space, thus the report looks messy, and the system does more work than it needs, it is far better to customise the queries and reports.

A Reports control form with explanatory command buttons to run the reports is the easiest and best way for your users.

Brian