Re: One check box or the other



Just FYI, you can do what you are asking but, I have had a case in the past
where I used a triple-state checkbox. Perhaps this will suit your needs.

You change the field to a number field and it stores "-1" for a checked
value, "0" for an unchecked value, and Null for a grayed out checkbox.

Again, this may or may not make sense for your particular application, but
it worked very well for us where we had an activity that was either
performed, not yet performed and required, or not yet performed and
optional.


--
Rick B



"BruceM" <bamoob@xxxxxxxxxxxxxxxxxx> wrote in message
news:%23L40gxArGHA.1368@xxxxxxxxxxxxxxxxxxxxxxx
I have a form on which are two check boxes (bound to Yes/No fields) that
cannot both be the same value. Under some circumstances neither will be
checked, so I don't think I can use an option group unless I add a third
option, which I don't want to do.
I know I can add this to one check box (and the inverse to the other):

Private Sub Check1_AfterUpdate()

Me.Check2 = Not Me.Check1

End Sub

However, I would like to know if I could handle both check boxes from a
single function (or sub), or otherwise streamline the process. The code
above, if placed in a function and called from the After Update event,
affects one check box differently than the other. I could write an If
statement to take care of both check boxes, but I wouldn't be saving
myself much coding.

My actual situation involves several pairs of check boxes, and other cases
in which a similar principle applies. It comes up often enough that I
would like to know if there is a way to handle it more efficiently.



.



Relevant Pages

  • One check box or the other
    ... I have a form on which are two check boxes that ... so I don't think I can use an option group unless I add a third ... Private Sub Check1_AfterUpdate ... single function, ...
    (microsoft.public.access.formscoding)
  • RE: Form checkboxes: value assignment
    ... with check boxes on it but I want all the check boxes to go to one cell in a ... Private Sub Form_Current ... Change "chkbxItem1" to the actual name of your first check box. ... Update event of the first Checkbox (in this example my first check box is ...
    (microsoft.public.access.forms)
  • RE: Query in VB/Passing it to a form/query
    ... Make the space below the bar with Form Footer nothing by dragging the ... You can make the form header larger by dragging the Detail bar down. ... insert your check boxes and check box labels. ... Private Sub Check1_AfterUpdate ...
    (microsoft.public.access.modulesdaovba)
  • RE: Assigned macro in Dialog giving error
    ... I vaguely remember the old dialog boxes now. ... Sub Dialog ... MsgBox "Sheets for all checked boxes have printed" ...
    (microsoft.public.excel.programming)
  • Re: Clear and Requery combo boxes
    ... Q1 - I would put the code to clear the combo boxes after the code that calls ... the report and before the code that makes form visible again. ... > The choices then generate a report based on the selection. ... > Exit Sub ...
    (microsoft.public.access.formscoding)

Loading