Results 1 to 3 of 3
  1. #1
    TheSpecialist is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2015
    Location
    Georgia
    Posts
    47

    This is my syntax error please help me

    This is my code



    SELECT T1.YourNumber, T1.YourDate,
    MoonPhaseTable.YourNumber AS MoonPhaseNumber
    FROM YourTable AS T1 INNER JOIN MoonPhaseTable
    ON T1.YourDate = MoonPhaseTable.YourDate
    WHERE T1.YourDate IN
    SELECT YourDate
    FROM YourTable AS T2
    WHERE T2.YourNumber = [Enter Number]
    UNION ALL
    SELECT YourDate-1
    FROM YourTable AS T3
    WHERE T3.YourNumber = [Enter Number]
    UNION ALL
    SELECT YourDate+1
    FROM YourTable AS T4
    WHERE T4.YourNumber = [Enter Number]
    ORDER BY T1.YourDate;


    This is my error:::

    In operator without() in query expression 'T1. YourDate IN
    SELECT YourDate
    FROM YourTable AS T2
    WHERE T2. YourNumber=[Enter Number]

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    replace UNION ALL
    with
    UNION

    and im not sure YourDate+1 will give what you want.
    use DATEADD

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    As the error mentions, the IN() operator requires parentheses:

    WHERE Field IN(SELECT...)
    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. Replies: 11
    Last Post: 05-01-2014, 11:56 AM
  2. Replies: 3
    Last Post: 01-23-2014, 07:49 AM
  3. Replies: 3
    Last Post: 03-05-2013, 11:17 AM
  4. Replies: 6
    Last Post: 05-30-2012, 12:32 PM
  5. Incomplete Syntax Clause (syntax error)
    By ajetrumpet in forum Programming
    Replies: 4
    Last Post: 09-11-2010, 10:47 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