Results 1 to 2 of 2
  1. #1
    eww is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Aug 2010
    Posts
    125

    INSERT INTO Syntax Error

    trying to run this:


    Code:
    strSQL = "INSERT INTO dbo_tblSubmittals(DetDBID, JobNum, Segment, Detlr, Desc, DetWgt, Comments, ReqSubDate, PropSubDate) " & _
    "VALUES('" & strDetDBID & "', '" & strCurrJobNum & "', '" & strSegment & "', '" & strEmpName & "', '" & Me.txtDesc.value & "', " & Me.txtDetWgt.value & ", '" & Me.txtNotes.value & "', #" & Me.txtReqSubDate.value & "#, #" & Me.txtPropSubDate.value & "#)"
    Debug.Print strSQL
    dbCMC.Execute strSQL, dbFailOnError
    and it keeps giving me a syntax error (3134). I'm getting this out of the debug:
    Code:
    INSERT INTO dbo_tblSubmittals(DetDBID, JobNum, Segment, Detlr, Desc, DetWgt, Comments, ReqSubDate, PropSubDate) VALUES('CTX', '1123705000', 'Level 2', 'Eric', 'BEAMS', 51000, 'test1', #4/7/2011#, #4/7/2011#)
    I don't see anything wrong there but maybe I've been looking at it too long, suggestions?

  2. #2
    eww is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Aug 2010
    Posts
    125
    found the problem, had to replace the table fields part with this
    Code:
    strSQL = "INSERT INTO dbo_tblSubmittals([DetDBID], [JobNum], [Detlr], [DetWgt], [Segment], [Desc], [ReqSubDate], [PropSubDate], [Comments]) " & _
    I have variations of this code elsewhere working without the brackets so I assume it has something to do with the dates...not sure. All I know is with the brackets it works.

    And if you're confused about the order of things, I rearranged to match the layout of the table order (it was out of order before). Not sure that it matters, but it was one of the things I was trying for the fix. The fix was definitely the brackets though.

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

Similar Threads

  1. Insert INTO syntax help
    By jpkeller55 in forum Access
    Replies: 3
    Last Post: 02-27-2011, 03:38 PM
  2. Combine insert into syntax
    By Cojack in forum Queries
    Replies: 1
    Last Post: 09-22-2010, 07:48 AM
  3. Incomplete Syntax Clause (syntax error)
    By ajetrumpet in forum Programming
    Replies: 4
    Last Post: 09-11-2010, 10:47 AM
  4. SQL INSERT INTO Date Syntax Error
    By tuna in forum Programming
    Replies: 5
    Last Post: 08-10-2010, 06:17 AM
  5. Syntax Error In Insert Into Statement
    By frankvfox in forum Queries
    Replies: 1
    Last Post: 09-09-2008, 12:35 PM

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