Results 1 to 6 of 6
  1. #1
    cbende2's Avatar
    cbende2 is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jun 2014
    Location
    Louisiana
    Posts
    370

    Question Filter problem


    Hello all,

    I'm experiencing a error when I go to add a filter, "Syntax error in string in query expression "MyFieldName""

    If I go to to the table where the field is located, I CAN apply a filter.

    However, If I throw this single field on a form and switch to datasheet view, all of a sudden I can not filter it.

    Additional info:
    whenever I go to build a query with the field, it throws brackets around this field and no others... this is weird.

    For example...
    Code:
    SELECT MyTable.field1, MyTable.field2, MyTable.[problemfield]
    FROM MyTable

    What's going on here?

    NOTES: there is no space in field name, the field is a date field
    Last edited by cbende2; 03-09-2015 at 02:58 PM. Reason: added some more info about problem

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    "Syntax error in string in query expression "MyFieldName""

    How about showing us the table design, and the form and any related code that gives the error message?

  3. #3
    cbende2's Avatar
    cbende2 is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jun 2014
    Location
    Louisiana
    Posts
    370
    By table design I'm not sure what you're asking, I'm guessing you want me to show you my table in design view?
    TABLE: Click image for larger version. 

Name:	Error1.png 
Views:	9 
Size:	58.3 KB 
ID:	19999
    FORM: Click image for larger version. 

Name:	Form1.png 
Views:	9 
Size:	112.1 KB 
ID:	20000
    QUERY:
    Code:
    SELECT AnnualTrackingTable.*FROM AnnualTrackingTable;

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    whenever I go to build a query with the field, it throws brackets around this field and no others... this is weird.
    That is normal. The reason Access adds the brackets is because you have spaces in the field name. Should never use spaces in object names; only alphanumeric and the underscore.

    Access would also add brackets around the field name "Plan Type" because of the space.

  5. #5
    cbende2's Avatar
    cbende2 is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jun 2014
    Location
    Louisiana
    Posts
    370
    Ssanfu, I know this is normal if you have spaces, but for the particular field 5500deadline, it puts brackets around it. That doesn't have a space, and it's the problem field.

  6. #6
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I don't have In a copy of 2013, so (in a copy of the dB) try changing the name so it doesn't start with a number.... maybe "dte5500deadline" or "deadline5500".

    Somewhere\somewhen I remember reading that Access might not like having field names the begin with a number. (but I could be wrong).

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

Similar Threads

  1. DAO Filter Problem
    By tad888 in forum Access
    Replies: 3
    Last Post: 08-13-2014, 12:42 PM
  2. Filter after pre Filter problem
    By gg80 in forum Programming
    Replies: 6
    Last Post: 07-18-2013, 10:45 AM
  3. filter problem
    By masoud_sedighy in forum Forms
    Replies: 2
    Last Post: 12-15-2011, 01:03 AM
  4. Filter problem
    By Callahan in forum Forms
    Replies: 0
    Last Post: 07-06-2011, 08:03 AM
  5. Filter problem
    By Javad in forum Access
    Replies: 0
    Last Post: 01-22-2011, 01:48 PM

Tags for this Thread

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