Results 1 to 2 of 2
  1. #1
    stahir01 is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Nov 2021
    Posts
    2

    Run-time error '3131' Syntax error in FROM clause

    DoCmd.RunSQL "INSERT INTO DB" & "(VT, xH, xN, Si, LT, Ont, Ser, Case, Comp, Survey_Date )" & _
    "SELECT VT, xH, xN, Si, LT, SUM(Ont), Ser, Case, Comp, Date() " & _
    "FROM raw_data" & _


    "GROUP BY VT, xH, xN, Si, LT, Ser, Case, Comp" & _
    "ORDER BY SUM(Ont) DESC;"

    I tried to run this code but it gives an error

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,566
    Put it ALL into a string variable and Debug.Print that.
    When you get it correct then just use

    DoCmd.RunSQL YourSqlString

    I am going to guess it is between the end of one line and the start of the next line at least.

    Edit: I see from your other post, https://www.accessforums.net/showthr...177#post486177, that you do not seem to take the advice I have just given?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

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

Similar Threads

  1. SYNTAX ERROR 3131 - Adding information to table via form
    By programmingnewby in forum Access
    Replies: 4
    Last Post: 07-11-2019, 10:22 AM
  2. Syntax error in From clause
    By GraeagleBill in forum Queries
    Replies: 9
    Last Post: 12-16-2014, 03:47 PM
  3. Replies: 13
    Last Post: 05-30-2014, 04:07 PM
  4. Syntax Error in FROM clause
    By cjohnston in forum Queries
    Replies: 2
    Last Post: 02-15-2012, 07:33 AM
  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