I’m trying to filter a list of Courses. On the Course table I have three fields: CourseNum, CourseName, CourseLevel. I’m trying to filter through the CourseLevel which is E for Elementary, J for Jr High, and S for Senior High. I’m using an option group to do this. After I set up the option group, I then wrote the following code:
Private Sub GradeOptions_AfterUpdate()
If GradeOptions = 3 Then
Me.Filter = “CourseLevel = ‘S'”
Me.FilterOn = True ‘Apply the filter.
Else
Me.FilterOn = False ‘Remove the filter.
End If
If GradeOptions = 2 Then
Me.Filter = “CourseLevel = ‘J'”
Me.FilterOn = True ‘Apply the filter.
Else
Me.FilterOn = False ‘Remove the filter.
End If
If GradeOptions = 1 Then
Me.Filter = “CourseLevel = ‘E'”
Me.FilterOn = True ‘Apply the filter.
Else
Me.FilterOn = False ‘Remove the filter.
End If
End Sub
This code doesn’t seem to do anything. I’ve tried a few different ways, but it always lists all of the courses. What am I doing wrong? Does anyone have any idea?