Results 1 to 3 of 3
  1. #1
    TheLazyEngineer is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    2

    runtime error 3134

    Hey, I'm new here and new to access. I'm trying to set up a simple database for my company that I can keep track of the programs we write, and the customer we write them for, etc...
    I'm having this recurring error with my code and I have no idea why it's happening, I have looked at pretty much every resource to no avail.

    The error is
    "Run-time error '3134':
    Syntax error in INSERT INTO statement."

    Here is my code, any help would be very appreciated, thanks!
    (I attempted to highlight the code that is giving me the error)
    ---------------------------------------------------------------------------------------
    Private Sub cmdAdd_Click()
    'add data to table
    CurrentDb.Execute "INSERT INTO PROGRAM(programid, programnum, robot, box, options, origrom, date, disk, customer) VALUES (" & Me.txtID & ",'" & Me.txtRobot & "','" & _ Me.txtBox & "'.'" & Me.txtOptions & "'.'" & Me.txtRom & "'.'" & Me.txtDate & _ "'.'" & Me.txtDisk & "'.'" & Me.txtCustomer & "')"
    'refresh data in list on form
    frmProgramSub.Form.Requery

    End Sub

    Private Sub cmdClear_Click()
    Me.txtNumber = ""
    Me.txtRobot
    Me.txtBox
    Me.txtOptions
    Me.txtRom
    Me.txtDisk
    Me.txtCustomer


    Me.txtDate

    Me.txtID.SetFocus
    End Sub

    Private Sub cmdClose_Click()
    DoCmd.Close

    End Sub

    Private Sub txtID_Click()

    End Sub
    ---------------------------------------------------------------------------------------

  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,521
    You've got some periods instead of commas, date fields would be surrounded by # rather than '. This should help debug it:

    BaldyWeb-Immediate window
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Your problem is the field "date" in the field list. "Date" should be considered a reserved word - this is one case where it causes problems in Access (SQL, actually).

    There are two solutions - one is to rename the "Date" field in your table to (for example) Program_Date if it is practical to do so; the other option is to use [Date], in square brackets in the value list so Access knows it is a field name.

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

Similar Threads

  1. Replies: 2
    Last Post: 10-15-2014, 04:23 AM
  2. Syntax error 3134 for Add function
    By gaker10 in forum Programming
    Replies: 9
    Last Post: 06-16-2014, 12:06 PM
  3. Replies: 13
    Last Post: 06-12-2012, 09:52 PM
  4. Run-time Error '3134'
    By avitale in forum Access
    Replies: 2
    Last Post: 05-20-2012, 07:40 PM
  5. Error in Runtime Only
    By drunkinmunki in forum Programming
    Replies: 7
    Last Post: 12-16-2010, 03:43 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