Results 1 to 2 of 2
  1. #1
    hellfire45 is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Mar 2015
    Posts
    24

    Syntax Error in my Access SQL Query

    When I run the below query, it is giving me an error:



    "the SELECT statement includes a reserved word or an argument name that is mispelled, or the punctuation is missing."

    Also, I'm fairly sure the IIF statement isn't working right. It needs to say if the Note column = "DEF_PREPARED" then it does that subtraction, otherwise its blank. However, its returning a blank even though I think it should be a subtracted value.

    Does anybody see where I goofed?

    Code:
    SELECT [SFJ Feb Full Perf].EntityID, 
    [SFJ WF 030115].[SFJ_STATUS First], 
    [SFJ WF 030115].SFJ_STATUS, 
    [SFJ WF 030115].Status, 
    [SFJ WF 030115].PreClose, 
    [SFJ WF 030115].[SFJ Assistant], 
    [SFJ WF 030115].SFJ_ASSIGN, 
    [SFJ Feb Full Perf].[Note ], 
    [SFJ Feb Full Perf].[Note Date Entered ], 
    [SFJ WF 030115].[Complaint Filed], 
    [SFJ WF 030115].[Svc Complete], 
    [SFJ WF 030115].[AOI Figs Recd], 
    [SFJ WF 030115].[AOI Figs Reqd], 
    [SFJ WF 030115].[AOI Prepd], 
    [SFJ WF 030115].TRIAL_REV_YES, 
    [SFJ WF 030115].TRIAL_REV_NO, 
    [SFJ WF 030115].[FC Stage], 
    
    
    [SFJ WF 030115].[Svc Complete]-[SFJ WF 030115].[Complaint Filed] AS [Comp Filed to Svc Comp CT],
    [SFJ WF 030115].[AOI Figs Reqd]-[SFJ WF 030115].[Svc Complete] AS [Svc Comp to JFigs Request CT],
    [SFJ WF 030115].[AOI Prepd]-[SFJ WF 030115].[AOI Figs Reqd] AS [JFigs Request to AOI Prep CT],
    [SFJ WF 030115].[TRIAL_REV_YES]-[SFJ WF 030115].[Svc Complete] AS [Svc Comp to NCIAI "Yes" CT],
    [SFJ WF 030115].[TRIAL_REV_NO]-[SFJ WF 030115].[Svc Complete] AS [Svc Comp to NCIAI "No" CT],
    IIF([SFJ Feb Full Perf].[Note ] = 'DEF_PREPARED',[SFJ Feb Full Perf].[Note Date Entered ]-[SFJ WF 030115].[Svc Complete],'') as [Svc Comp to Def Prep CT]
    
    
    [SFJ WF 030115].[SFJ_STATUS First]-[SFJ WF 030115].[SFJ_ASSIGN] AS [SFJ Assign to SFJ Status first CT],
    DATE()-[SFJ WF 030115].[SFJ_STATUS] AS [SFJ Status Aging]
    
    
    FROM [SFJ Feb Full Perf] INNER JOIN [SFJ WF 030115] ON [SFJ Feb Full Perf].EntityID = [SFJ WF 030115].File;

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    You seem to be missing a comma at the end of your IIF calculated field.

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

Similar Threads

  1. Replies: 3
    Last Post: 01-29-2015, 07:48 PM
  2. Replies: 11
    Last Post: 05-01-2014, 11:56 AM
  3. Replies: 3
    Last Post: 03-05-2013, 11:17 AM
  4. Replies: 6
    Last Post: 05-30-2012, 12:32 PM
  5. Access 2007 syntax error in query
    By ivanver in forum Queries
    Replies: 3
    Last Post: 04-23-2011, 09:41 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
  •  
Other Forums: Microsoft Office Forums