Link to home
Start Free TrialLog in
Avatar of Gary Samuels
Gary SamuelsFlag for United States of America

asked on

global checkboxes

Is it possible to define a checkbox in Module1, then place the checkbox on form1 making the checkbox value a global variable that can be used on form2?
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

It is probably better to leave Form1 (the one with the checkboxes) open but hidden, and refer directly to the checkboxes.  Otherwise you will have to manage 30+ global variables.

If what you are trying to do is allow the user to identify which fields to include in a query, I would recommend the multi-select list I mentioned in response to your previous question.  Would help if we knew what you were trying to do, rather than proposing a solution and asking us to help with that solution.
Avatar of Gary Samuels

ASKER

Yes, I'm trying to develop a way that the user can identify which fields to include in a query. I did a quick look into the multi-select list and it told me I could not have over 20 items in the list?

My thought on the checkboxes was to have a default value of true on 6 of the most common fields. If the user did a search without opening the checkbox form these 6 fields would be included in the query. If the user wanted something different they would open the checkbox form, make their selection and run the query while the checkbox is open. When the checkbox is closed the query defaults back to the 6 common fields.
SOLUTION
Avatar of Nick67
Nick67
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Actually, I've used the same technique recommended by Nick for a wide variety of projects.  

The advantage of his method (continuous subform with checkboxes) is that multi-select lists can be tempermental.  If you for get to hold down the ctrl or shift key, you can wipe out all of your previous selections.  With the continuous form displaying the fieldname and a checkbox,  you don't have that problem.
Other nice advantages are that
1. The choices get stored in a table, so they don't get wiped out by a run-time error,which can happen to variables.
2. There will only be the choices selected to build your string from.  No parsing out unselected choices.
3. Many fewer controls
4. Much simpler code
Thanks