Check boxes and new record button

F

fossy

hello all,
On my form I have 2 check boxes and a new record button. I need the
user to check one of the boxes for sure (but only one), and if it doesn't the
button will not work...
Can anyone help me with this code

Thanks. Saul.
 
J

JimBurke via AccessMonster.com

The simplest thing to do is, at the beginning of the button's on-click event
check to make sure that one of the checkboxes is selected. If not, tell the
user to check one, then exit the sub. Somehting like:

Private Sub cmdButtom_OnClick

if not (chkBox1 or chkBox2) then
msgbox "You must select a checkbox before adding a new record."
exit sub
end if

....

Change the field names to your check box names and the re-word the message
however you want.
 
Top