Results 1 to 3 of 3
  1. #1
    Cueball11 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Oct 2015
    Location
    Here
    Posts
    1

    The run-time Error 3129 mystery. Too hot for Scooby & the gang!

    Strictly speaking this isn't a problem with a query but rather an insert into a table. I have created an Insert statement by concatenating key words, the name of the table plus all its columns (belt and suspenders approach to cover my arse!) and the values from multiple form controls. Then I try to run the statement with a DoCmd.RunSQL("txt_SQLStmt") command. At this point I get Run-time Error 3129 Invalid SQL Statement.

    The code in the click event for the Save button is as follows...

    Dim Txt_SQLStmt As String

    Txt_SQLStmt = "INSERT INTO ICTAssets (EdQuipNo, WorkStationNo, ItemType, ItemClass, Serial/ServTag, LocationBlock, " & _
    "LocationRoom, Manufacturer, Model, PurchaseDate, WarrantyEnd, Description, Deleted) VALUES ('" & _
    Me![EdQuipNo].Value & "', '" & Me![txt_WorkStationNo].Value & "', " & _
    Me.ComboItemType.Value & ", " & Me.ComboItemClass.Value & ", '" & Me![Txt_SerialServTag].Value & "', " & _
    Me.ComboLocationBlock.Value & ", " & Me.ComboLocationRoom.Value & ", " & Me.ComboManufacturer.Value & ", " & _
    Me.ComboModel.Value & ", #" & Me![Dte_Purchased].Value & "#, #" & Me![Dte_WarrantyEnd].Value & "#, '" & _
    Me![Txt_Description].Value & "', " & False & ");"

    MsgBox (Txt_SQLStmt)

    DoCmd.RunSQL ("Txt_SQLStmt")



    At first I declared Txt_SQLStmt as a Variant but that didn't seem to matter.

    Have I left something out? Or is it simply a syntax error that I can't see for looking at it for waaaaayyyyy toooooo long?

    Further, the data seems to be getting sent to the table despite the error message, however, to see the changes I have to log out of Access and back in again. I don't know if that is related to the error message because I am new to Access and it doesn't seem to work at all like SQL Server, Oracle, Sybase, MySQL or Ingres - the RDBMSs I have used previously.

    Thanks in advance

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Well, your variable shouldn't be in quotes to start with:

    DoCmd.RunSQL Txt_SQLStmt

    If the data is still going to the table, I'd wonder if the form was bound. Normally you'd use a bound form or SQL, not both (normally a bound form actually).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    NTC is offline VIP
    Windows 7 64bit Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    I would suggest you build an Insert Query using the query design tool...when it works - then option it for SQL View to see the correct syntax.

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

Similar Threads

  1. Form Mystery Record 159
    By justphilip2003 in forum Forms
    Replies: 17
    Last Post: 06-03-2013, 12:59 PM
  2. Mystery Mismatch in Data Type
    By KelleyM in forum Queries
    Replies: 3
    Last Post: 09-11-2012, 12:14 PM
  3. Replies: 16
    Last Post: 06-18-2012, 02:27 PM
  4. relationships for gang database
    By DMJ in forum Database Design
    Replies: 8
    Last Post: 11-11-2011, 07:52 AM
  5. Calendar Mystery
    By BankWalker in forum Forms
    Replies: 0
    Last Post: 02-16-2006, 01:29 PM

Tags for this Thread

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