I have a form that would like to filter results in order to open a report.
On the form you will select a course from the combobox and then select the report you'd like to open from the option group and finally click a button to open the report.
The form is called 'Main', the option group is called 'Frame5' and the Combobox is called 'MyCategory'. At present I have two reports named rptStudents and rptStaff.
The On Click code for the button currently is:
Private Sub Open_Report_Click()
Dim stDocName As String
Dim stLinkCriteria As String
If [Frame5].Value = 1 Then
stDocName = "rptStudents"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Else
If [Frame5].Value = 2 Then
stDocName = "rptStaff"
DoCmd.OpenReport stDocName, acPreview
End If
End If
End Sub
When you click this it displays the appropriate report based on what option button I have selected but it doesn't filter by the course.
Any ideas? Do I need to add something to the recordsource on the query builder?
On the form you will select a course from the combobox and then select the report you'd like to open from the option group and finally click a button to open the report.
The form is called 'Main', the option group is called 'Frame5' and the Combobox is called 'MyCategory'. At present I have two reports named rptStudents and rptStaff.
The On Click code for the button currently is:
Private Sub Open_Report_Click()
Dim stDocName As String
Dim stLinkCriteria As String
If [Frame5].Value = 1 Then
stDocName = "rptStudents"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Else
If [Frame5].Value = 2 Then
stDocName = "rptStaff"
DoCmd.OpenReport stDocName, acPreview
End If
End If
End Sub
When you click this it displays the appropriate report based on what option button I have selected but it doesn't filter by the course.
Any ideas? Do I need to add something to the recordsource on the query builder?