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.
 

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

Top