Selecting fields in query (1 Viewer)

Groundrush

Registered User.
Local time
Today, 13:14
Joined
Apr 14, 2002
Messages
1,376
I have a query that is used to capture all the fields that can be possibly used.

When run & exported to excel the user then simply deletes the columns with the fields that they don't require.

We do this so we don't have to keep creating queries over and over again when you just use one that does all but then delete what you don't need afterwards.

Anyone know of a way of using a form with tick boxes for each of these fields so when they user ticks the fields they require reporting on then only those fields will be returned in the query.

Thanks
 

Mr. B

"Doctor Access"
Local time
Today, 08:14
Joined
May 20, 2009
Messages
1,932
You can use VBA to check each check box to see if it is checked and if so create the sql statement by concatenating each of the field names (identified by each check box) into a correctly formed sql statement. Then use the QueryDef method to assign your sql statement created in your VBA code to be the sql for your existing query. Then just use your query as you are currently using it.

This will allow you to have a custom set of fields returned by the same query based on user selections.

Hope this helps.
 

Users who are viewing this thread

Top Bottom