The VBA procedure is not using field names that are in the query:
Stdnt#
Staff ID
Date
Why did you use alias Date for GradeDate? Date is a reserved word and should not use reserved words as names.
Also, should not use spaces, special characters/punctuation (underscore is exception) in names.
Fix the query field names or fix the code or both, just get them in sync.
The student number is a text field so the criteria will need delimiters (Allen used doubled quote marks, I like apostrophe). The date values need # delimiters (Allen used the Format function and a custom constant to define a format parameter).
Basing criteria on staff initials is bound to fail. Multiple people can have same initials. However, again, this is text criteria, need delimiters.
Why don't you use comboboxes?
Consider (note the field names):
Code:
If Not IsNull(Me.fltrFromDate) Or Not IsNull(Me.fltrToDate) Then
strWhere = strWhere & "([GradeDate] BETWEEN #" & Nz(Me.fltrFromDate,"1/1/1900") & "# AND #" & Nz(Me.fltrToDate,"12/31/2900") & "#) AND "
End If
If Not IsNull(Me.fltrStaffID) Then
strWhere = strWhere & "([Staff] = '" & Me.fltrStaffID & "') AND "
End If
If Not IsNull(Me.fltrStudentID) Then
strWhere = strWhere & "([StdntNo] = '" & Me.fltrStudentID & "') AND "
End If