I have a to do list that I am trying to filter a checkbox field to show either complete or yet to do. I am using two option buttons complete or To Do for the user to pick to see besides all of them.
I keep getting this error 3075 Syntax error in query expression "To Do List.Completed" Below is my code. I have tried changing the -1,0 values numerous ways same result. What am I missing???
Option Compare Database
Option Explicit
'Set default record source of form
Const strSQL = "SELECT To Do List.Completed,To Do List.EventID,To Do List.EventDescription,To Do List.StartDate,To Do List.EndDate,To Do List.ServiceCodeID,To Do ListPriority FROM To Do List"
Private Sub cmdFilterRecords_Click()
'Variable to hold filtered SQL string
Dim strFilterSQL As String
Select Case Me!optFilterBy
'Filter record source dependant on option checked
Case 1
strFilterSQL = strSQL & " Where [Completed] = 0"
Case 2
strFilterSQL = strSQL & " Where [Completed] = -1"
'If filter applied with no option selected use default record source
Case Else
strFilterSQL = strSQL & ";"
End Select
' Set record source with filtered SQL
Me.RecordSource = strFilterSQL
Me.Requery
End Sub
Private Sub cmdRemoveFilter_Click()
' This procedure will restore the RecordSource to the original dataset.
Me.RecordSource = strSQL & ";"
End Sub
Thanks Bill