checkboxes & command button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, have a switchboard form with alot of checkboxes that when one is
selected it opens a specific report/form. Works fine. But what I really
need is to check a checkbox - and then open the appropriate form when a
command button (i.e. View) is pressed. Am presuming it is a simple macro
with the 'condition' being the checkbox name being of value x (i.e.
selected). And so I would list all the checkboxes,with condition, and the
openform command....so that whichever checkbox is selected then it's value
would identify it as selected. But not sure what the values are for checked
boxes. Is this the right idea? would welcome an example. thanks.
 
Will add that when I put: [checkboxname]=True into the Condition column on
the Macro builder that I get a "Type Mismatch" error message.....

Not sure how the format for this set up is suppose to work.
 
NTC,

I assume the Command Button that your macro is assigned to is on the
same form as the checkboxes? If so, I would expect that
[checkboxname]=True in the macro Condition would be correct. I myself
would normally use [checkboxname]=-1 but [checkboxname]=True should also
work. The checkboxes aren't part of an Option Group, are they? It is
entirely possible that the error message is not related to the macro
Condition at all, and is caused by something else, such as one of the
arguments of the OpenForm action in the macro, or else something to do
with the form or the query that the form is based on. To test,
temporarily replace the OpenForm action with something else, for example
a MsgBox action, and see if this works properly.
 
Ah yes indeed the many checkboxes are grouped into separate Option Groups.
The single command button is not in any Option Group.

And I know I can do a simple OpenForm macro directly from any checkbox - - -
the "Type Mismatch" only comes when I try to do it via command button.....and
I've tried all combinations of [Checkbox]=True/False/0/-1

........So I guess maybe that my macro 'condition' is lacking the identity of
the OptionGroup in addition to the Checkbox in its expression.....that would
make sense. Am not sure how that expression would look though.... but
you've triggered more thinking on this...thanks....if you know off hand the
correct expression please send along.
--
NTC


Steve Schapel said:
NTC,

I assume the Command Button that your macro is assigned to is on the
same form as the checkboxes? If so, I would expect that
[checkboxname]=True in the macro Condition would be correct. I myself
would normally use [checkboxname]=-1 but [checkboxname]=True should also
work. The checkboxes aren't part of an Option Group, are they? It is
entirely possible that the error message is not related to the macro
Condition at all, and is caused by something else, such as one of the
arguments of the OpenForm action in the macro, or else something to do
with the form or the query that the form is based on. To test,
temporarily replace the OpenForm action with something else, for example
a MsgBox action, and see if this works properly.

--
Steve Schapel, Microsoft Access MVP

Will add that when I put: [checkboxname]=True into the Condition column on
the Macro builder that I get a "Type Mismatch" error message.....

Not sure how the format for this set up is suppose to work.
 
NTC,

The checkboxes within the Option Group each have an Option Value
property. Check this. Then, your Condition needs to refer to the value
of the Option Group, as determined by the Option Value of the ticked
checkbox, like this (for example)...
[OptionGroupName]=3
 
that's it!! thanks it works. Appreciate the help Steve.
--
NTC


Steve Schapel said:
NTC,

The checkboxes within the Option Group each have an Option Value
property. Check this. Then, your Condition needs to refer to the value
of the Option Group, as determined by the Option Value of the ticked
checkbox, like this (for example)...
[OptionGroupName]=3

--
Steve Schapel, Microsoft Access MVP

Ah yes indeed the many checkboxes are grouped into separate Option Groups.
The single command button is not in any Option Group.

And I know I can do a simple OpenForm macro directly from any checkbox - - -
the "Type Mismatch" only comes when I try to do it via command button.....and
I've tried all combinations of [Checkbox]=True/False/0/-1

.......So I guess maybe that my macro 'condition' is lacking the identity of
the OptionGroup in addition to the Checkbox in its expression.....that would
make sense. Am not sure how that expression would look though.... but
you've triggered more thinking on this...thanks....if you know off hand the
correct expression please send along.
 
Back
Top