I'm looking to change the design of a form so that there are 3 combo boxes (cmbStaff, cmbRoom, cmbClass) that either have a value to filter by or a Null value (e.g. I've set the code to make Null cmbRoom and cmbClass when you select an item from cmbStaff etc.) so only 1 combo box has a value.
I want to add a command button that will print one of three reports depending on which combo box has a value. I've played around with If and nested If but its Friday and my brain isn't working... Any suggestions? The code as it stands is below. Its probably staring me in the face (wood for the trees...):
****************
Private Sub btnTTview_Click()
Dim stDocName As String
If cmbRoom <> "" Then
stDocName = "rpt_TT_Room"
DoCmd.OpenReport stDocName, acPreview
If cmbClass <> "" Then
stDocName = "rpt_TT_Class"
DoCmd.OpenReport stDocName, acPreview
If cmbStaff <> "" Then
stDocName = "rpt_TT_Staff"
DoCmd.OpenReport stDocName, acPreview
End If
End If
Else
MsgBox "Please select a Room, Class or Member of Staff to view a Timetable"
End If
End Sub
****************
Thanks
Simon
I want to add a command button that will print one of three reports depending on which combo box has a value. I've played around with If and nested If but its Friday and my brain isn't working... Any suggestions? The code as it stands is below. Its probably staring me in the face (wood for the trees...):
****************
Private Sub btnTTview_Click()
Dim stDocName As String
If cmbRoom <> "" Then
stDocName = "rpt_TT_Room"
DoCmd.OpenReport stDocName, acPreview
If cmbClass <> "" Then
stDocName = "rpt_TT_Class"
DoCmd.OpenReport stDocName, acPreview
If cmbStaff <> "" Then
stDocName = "rpt_TT_Staff"
DoCmd.OpenReport stDocName, acPreview
End If
End If
Else
MsgBox "Please select a Room, Class or Member of Staff to view a Timetable"
End If
End Sub
****************
Thanks
Simon