I would like to have a command button in a form that opens another form ,first test the value of a check box.Based on the result the button would either open the form allowing access to it or inform the user that the check box must be checked first.The following code checks a text box for null and either grants or denies access to the form.Anyone know how to make it check the status of a checkbox?
Private Sub My_form2_Click()
On Error GoTo Err_My_form2_Click
If IsNull(Me![My_text]) Then
MsgBox "Mytext must entered before opening My_form2 form."
Else
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenForm "My_form2"
End If
Exit_My_form2_Click:
Exit Sub
Err_My_form2_Click:
MsgBox Err.Description
Resume Exit_My_form2_Click
End Sub
Private Sub My_form2_Click()
On Error GoTo Err_My_form2_Click
If IsNull(Me![My_text]) Then
MsgBox "Mytext must entered before opening My_form2 form."
Else
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenForm "My_form2"
End If
Exit_My_form2_Click:
Exit Sub
Err_My_form2_Click:
MsgBox Err.Description
Resume Exit_My_form2_Click
End Sub