Results 1 to 3 of 3
  1. #1
    kagoodwin13 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Feb 2012
    Posts
    181

    Need some help debugging an INSERT INTO query

    I have the following query that is returning a syntax error, but I can't seem to find it. Can someone help me out?



    The VBA debugger is highlighting "DoCmd.RunSQL strSQL" in yellow, but I doubt that is the problem. I think it is only finding the bug upon running the command, which is run at that line.

    Code:
    strSQL = "INSERT INTO tblGOOGLE_DATABASE_V2 ( ID, Project_Name, Project_Manager, Implementation_Specialist, Kickoff, Kickoff_Projected, Train_the_Trainer, Train_the_Trainer_Projected, Go_Live, Go_Live_Projected, Planning_Date, Planning_Percent, Pre_Project_Planning_Date, Pre_Project_Planning_Percent, Core_Setup_Phase_I_Date, Core_Setup_Phase_I_Percent, Configuration_Date, Configuration_Percent, Kickoff_Date, Kickoff_Percent, Core_Setup_Phase_II_Date, Core_Setup_Phase_II_Percent, Core_Setup_Phase_III_Date, Core_Setup_Phase_III_Percent, Certification_Date, Certification_Percent, Train_The_Trainer_Date, Train_The_Trainer_Percent, System_Certification_Date, System_Certification_Percent, Go_Live_Preparation_Date, Go_Live_Preparation_Percent, Live_Date, Live_Percent, Implementation_Support_Date, Implementation_Support_Percent, Transition_To_Support_Date, Transition_To_Support_Percent, MRR, Location, Phase ) " & _
    "SELECT tblGOOGLE_DATABASE_TEMP.[ID], tblGOOGLE_DATABASE_TEMP.[Project Name], tblGOOGLE_DATABASE_TEMP.[Project Manager], tblGOOGLE_DATABASE_TEMP.[Implementation Specialist], tblGOOGLE_DATABASE_TEMP.[Kickoff], tblGOOGLE_DATABASE_TEMP.[Kickoff Projected], tblGOOGLE_DATABASE_TEMP.[Train The Trainer], tblGOOGLE_DATABASE_TEMP.[Train The Trainer Projected], tblGOOGLE_DATABASE_TEMP.[Go Live], tblGOOGLE_DATABASE_TEMP.[Go Live Projected], tblGOOGLE_DATABASE_TEMP.[Planning Date], tblGOOGLE_DATABASE_TEMP.[Planning Percent], tblGOOGLE_DATABASE_TEMP.[Pre Project Planning Date], tblGOOGLE_DATABASE_TEMP.[Pre Project Planning Percent], tblGOOGLE_DATABASE_TEMP.[Core Setup Phase I Date], tblGOOGLE_DATABASE_TEMP.[Core Setup Phase I Percent], tblGOOGLE_DATABASE_TEMP.[Configuration Date], tblGOOGLE_DATABASE_TEMP.[Configuration Percent], tblGOOGLE_DATABASE_TEMP.[Kickoff Date], tblGOOGLE_DATABASE_TEMP.[Kickoff Percent], tblGOOGLE_DATABASE_TEMP.[Core Setup Phase II Date], tblGOOGLE_DATABASE_TEMP.[Core Setup Phase II Percent], " & _
    "tblGOOGLE_DATABASE_TEMP.[Core Setup Phase III Date], tblGOOGLE_DATABASE_TEMP.[Core Setup Phase III Percent], tblGOOGLE_DATABASE_TEMP.[Certification Date], tblGOOGLE_DATABASE_TEMP.[Certification Percent], tblGOOGLE_DATABASE_TEMP.[Train The Trainer Date], tblGOOGLE_DATABASE_TEMP.[Train The Trainer Percent], tblGOOGLE_DATABASE_TEMP.[System Certification Date], tblGOOGLE_DATABASE_TEMP.[System Certification Percent], tblGOOGLE_DATABASE_TEMP.[Go Live Preparation Date], tblGOOGLE_DATABASE_TEMP.[Go Live Preparation Percent], tblGOOGLE_DATABASE_TEMP.[Live Date], tblGOOGLE_DATABASE_TEMP.[Live Percent], tblGOOGLE_DATABASE_TEMP.[Implementation Support Date], tblGOOGLE_DATABASE_TEMP.[Implementation Support Percent], tblGOOGLE_DATABASE_TEMP.[Transition To Support Date], tblGOOGLE_DATABASE_TEMP.[Transition To Support Percent], tblGOOGLE_DATABASE_TEMP.[MRR], tblGOOGLE_DATABASE_TEMP.[Location], tblGOOGLE_DATABASE_TEMP.[Phase], " & _
    "FROM tblGOOGLE_DATABASE_TEMP; "
    DoCmd.RunSQL strSQL

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Easier to debug long SQL statements if it is built incrementally. Like:

    strSQL = "INSERT INTO tblGOOGLE_DATABASE_V2 "
    strSQL = strSQL & ( ID, Project_Name, Project_Manager, Implementation_Specialist, Kickoff, Kickoff_Projected, Train_the_Trainer, Train_the_Trainer_Projected, Go_Live, "
    ...

    Remove extraneous comma before FROM and add a space:
    ... tblGOOGLE_DATABASE_TEMP.[Phase] " & _
    "FROM ...
    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
    kagoodwin13 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Feb 2012
    Posts
    181
    The comma was it. I like the tip for debugging long strings too.

    Thanks June7!

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

Similar Threads

  1. Temporal Variables and Debugging
    By Demerit in forum Programming
    Replies: 2
    Last Post: 01-03-2015, 02:32 AM
  2. debugging access 2013 crash
    By DKP in forum Programming
    Replies: 6
    Last Post: 10-06-2014, 10:23 AM
  3. INSERT query: insert new data only
    By drh in forum Access
    Replies: 2
    Last Post: 04-04-2014, 05:31 PM
  4. Debugging
    By eacollie in forum Programming
    Replies: 2
    Last Post: 06-04-2011, 05:29 AM
  5. Debugging help
    By Buakaw in forum Access
    Replies: 3
    Last Post: 02-16-2011, 09:50 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