Results 1 to 4 of 4

Don't understand the error message

  1. #1
    PATRICKPBME is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2016
    Posts
    153

    Don't understand the error message

    I have a field in a table called Production Transition. The record in that field is either a date (1-1-19) or the letters NA or the word Currently. When I set up my query for this field I set the criteria for this field as Not "NA" and Not "Currently" as I don't want those to appear in the resulting spreadsheet. When I run the query all is good and only the dates remain. However, when I try to sort the remaining dates I am told:



    "Syntax error (missing operator) in query expression "Production Transition'.

    Have played with this for hours and can't figure out what the heck the issue is!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    48,222
    I would not mix dates and text in same field.

    A date value in text field will likely not sort as expected. 12-1-19 will sort before 9-1-19. Data would have to include placeholder zeros. 09-01-19 will sort before 12-01-19. Or use Format function to restructure.

    Format([Production Transition], "mm/dd/yyyy")

    Post the attempted query statement.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    2,040
    There's also a function you could look at: IsDate([Production Transition])

  4. #4
    Ajax is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    7,547
    if you can store the values as numbers you can use the format property

    in case you don't know, dates are numbers so today is 43749 (number of days since 31/12/1899)

    so if 'currently' can be represented with a 0 and 'N/A' with a -1 you could use a format property like this

    mm-dd-yy;"N/A";"Currently"


    Click image for larger version. 

Name:	Capture.PNG 
Views:	11 
Size:	4.2 KB 
ID:	39926

    issue would be data entry- user would need to know to enter -1 or 0 but if this is not a data entry field, should work for you. Benefit is your data will sort properly and can be used for query joins, criteria and easier calculations

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

Similar Threads

  1. Replies: 6
    Last Post: 01-04-2018, 08:29 PM
  2. code error I don't understand why
    By LaughingBull in forum Access
    Replies: 5
    Last Post: 06-21-2017, 06:01 PM
  3. Replies: 7
    Last Post: 03-17-2016, 05:53 PM
  4. Replies: 5
    Last Post: 07-10-2013, 05:07 AM
  5. Replies: 2
    Last Post: 07-11-2011, 05:34 AM

Posting Permissions

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