pop up message if one of my two check boxes isnt checked

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

Guest

Hello, I have a form with two check boxes. Before the form is closed one of
the two boxes have to be checked. Is there any way I can have a pop up
message to tell the user they have to check one? (Newbie) Thanks!!!
 
I think this is right - if not, there are many more qualified people to
answer than I.

If this is a "one-or-the-other-not-both" selection (typically presented as
radio buttons), and if the option is bound to a table field in the
recordsource, you can simply make the field "Required" in the table.

If it is unbound or there are ungrouped check boxes bound to separate
fields, you will have to code in the BeforeUpdate event of the form, for
example:

If me!chkOption1 = False and Me!chkOption2 = False then
{display your custom message here}
Cancel = True
End If
 
I think this is right - if not, there are many more qualified people to
answer than I.

If this is a "one-or-the-other-not-both" selection (typically presented as
radio buttons), and if the option is bound to a table field in the
recordsource, you can simply make the field "Required" in the table.

If it is unbound or there are ungrouped check boxes bound to separate
fields, you will have to code in the BeforeUpdate event of the form, for
example:

If me!chkOption1 = False and Me!chkOption2 = False then
{display your custom message here}
Cancel = True
End If





- Vis sitert tekst -

Except you must use Form_Unload:

Private Sub Form_Unload(Cancel As Integer)
If Me!Chk1 = False And Me!Chk2 = False Then
MsgBox "You must fill bla bla bla.."
Cancel = True
End If
End Sub
 
So which is it? I have 2 check boxes on my form and if neither is checked I
want a message to pop up not letting them close untill they check either one.
I cant set the tbl to required on both boxes because then I would have to
check both. So which do I use the one from KillMe or the one from AccessTexas
or do I use both? One in the unload and the other in the beforeUpdate.
Thanks!!!
 
Sorry one more Question. I have another form that requires you to select one
of 8 chk boxes how would I write that? KillMe thanks yours worked!! I kept
getting an error on the other code but thanks for the help AccessTexas!


" Private Sub Form_Unload(Cancel As Integer)
If Me!Chk1 = False And Me!Chk2 = False Then
MsgBox "You must fill bla bla bla.."
Cancel = True
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top