Hi. I'm taking a VBA class in 2 weeks, so bear with me please! I have a form with 10 reports listed on it with a checkbox by each. Checkboxes are named check1, check2, etc. There is also a listbox with rep names. I need user to be able to check one or more reports and then press a PRINT button. If they forget to choose a rep, I want a message to display. Here is the event code on the PRINT button. I've tried various things. It always bombs if I have an unchecked checkbox before a checked box. Please VBA gurus ... this will be easy for you but it's pretty greek to me right now. What should my code look like to accomplish the above with no errors.
Private Sub cmbPrintReports_Click()
If IsNull(RepName) Then
MsgBox "Please choose name of Sales Rep"
End If
If [check1] Then
DoCmd OpenReport "Report1", acviewNormal
End If
If [check2] Then
DoCmd OpenReport "Report2", acviewNormal
End If
.....and so on for 8 more reports, then
Exit Sub
Private Sub cmbPrintReports_Click()
If IsNull(RepName) Then
MsgBox "Please choose name of Sales Rep"
End If
If [check1] Then
DoCmd OpenReport "Report1", acviewNormal
End If
If [check2] Then
DoCmd OpenReport "Report2", acviewNormal
End If
.....and so on for 8 more reports, then
Exit Sub