Results 1 to 13 of 13
  1. #1
    fredj5000 is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2020
    Posts
    8

    syntax error (missing operator) in query expression in datasheet view of form


    I have been using the same data file for 3 years now for my personal sales CRM, and have had issues with my everyday contact form. In the datasheet view om my form, when clicking on the drop down to filter records I get the "syntax error (missing operator) in the query expression ..." on 3 fields (callback date, contact name, & company name). It did not used to to this, but has been for about a year now. This was all created with GUI, and I haven't written code in 20 years. Where do I even look?

  2. #2
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,474
    Can you give more detail. So you have a form you open in Datasheet view and if you click on any of those 3 fields to filter by drop down, once you select something it gives you that error? Do you have other fields in that datasheet form that you can filter that does not give you that error? Is there data in those fields for the value you are filtering?

  3. #3
    fredj5000 is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2020
    Posts
    8
    That was quick. Thank you!

    When I click on the drop down I get the error message, I click OK, and then I can filter. There are 20 fields in the datasheet, and this error only occurs on those 3 fields. Most of the records have a value, but some are blank. That was never an issue before the error message appeared. I used to be able to check/uncheck dates from the drop down, and it just disappeared a while back.

  4. #4
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,474
    So the error appears when you just click on the arrow to bring up the options I believe you said, but when you click ok, then you can go select what you want and it does the filter?

  5. #5
    fredj5000 is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2020
    Posts
    8
    That is correct. What is missing is a list of options to check/uncheck. I have to manually enter values to search for. It is like it lost its index.

  6. #6
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Hi, this is a known issue with datasheet sorting/filtering, and it happens because of your space in the field names, enclose them in square brackets and it should be fine:
    https://social.msdn.microsoft.com/Fo...orum=accessdev

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  7. #7
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,474
    I have not had this issue, I do not use datasheet view often. Just getting more info incase someone else has seen this. Is the Callback date a string or an actual date datatype?

    Maybe try a few tests. Create a new datasheet form and only add those 3 fields and see if it does the same thing. If it does not then it is something with your form. Maybe create a new form and copy/paste the objects from old to new form and see if still get issue?

  8. #8
    fredj5000 is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2020
    Posts
    8
    Do I change the field name in the source table or in the form somewhere?

  9. #9
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,474
    I would not change anything in the table yet, try to create a new blank form, add that table as the Recordsource and just add one of those fields to the form(make it a datasheet form), open it and see if you can do the filter and not get the error? Trying to see if it is you form or the data/table that has the issue.

  10. #10
    fredj5000 is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2020
    Posts
    8
    Putting bracket around the field names fixed it. Thank you all!

  11. #11
    fredj5000 is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2020
    Posts
    8
    Well... almost. Now I get data type mismatch when selecting 'Today' from the date drop down. I feel like a rookie.

  12. #12
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,474
    If date maybe try # around the value.

  13. #13
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    What is the recordsource of the form? If it is a Select statement string try save it as a query and use that instead, these problems usually go away if you use saved queries as your recordsource.

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

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

Similar Threads

  1. Syntax Error (missing operator) in query expression
    By johndoe123 in forum Programming
    Replies: 2
    Last Post: 05-13-2019, 07:56 PM
  2. Replies: 3
    Last Post: 11-07-2017, 06:26 PM
  3. Replies: 4
    Last Post: 03-16-2016, 12:24 PM
  4. Replies: 2
    Last Post: 02-17-2014, 10:27 AM
  5. Replies: 9
    Last Post: 01-22-2013, 04:23 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