Results 1 to 5 of 5
  1. #1
    whm1 is offline Novice
    Windows XP Access 2000
    Join Date
    Mar 2010
    Posts
    3

    Runtime 3075 error

    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

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Spaces are inadvisable; you have to bracket any name that contains them:

    [To Do List]
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Gerry is offline Rusty Developer
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    Kings Mountain, NC
    Posts
    33
    Also, if you copied and pasted that SQL, you're missing a "." in the last field reference: [To Do List].[Priority]

  4. #4
    whm1 is offline Novice
    Windows XP Access 2000
    Join Date
    Mar 2010
    Posts
    3

    Woorks great

    Awesome!! Used both recommendations. Worked perfect first time.

    Thanks

    pbaldy / gerry

    (I never would have seen the missing period)

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help. You would probably have noticed the missing period when adding the brackets, or had your attention called to it when you got a parameter prompt after fixing the brackets.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Error 3075 Missing Operator
    By KLynch0803 in forum Queries
    Replies: 5
    Last Post: 02-11-2010, 01:13 PM
  2. 2003 Runtime
    By miclar99 in forum Access
    Replies: 4
    Last Post: 01-12-2010, 05:30 PM
  3. Change menu name in runtime
    By uriik in forum Access
    Replies: 0
    Last Post: 09-04-2009, 03:24 AM
  4. Access runtime on CD?
    By Orabidoo in forum Access
    Replies: 1
    Last Post: 08-19-2009, 01:51 AM
  5. Replies: 5
    Last Post: 08-05-2009, 04:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums