Results 1 to 6 of 6
  1. #1
    vicsaccess's Avatar
    vicsaccess is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    451

    insert getting runtime error 3134

    i'm having some problems figuring this one out and i'm needing someone to look at it and see what i'm not seeing. sometimes if I look at it to long I don't see the obvious. i'm using an unbound form with several combo boxes and text fields and then using an update button to update the data to the table but my string is getting a run-time error '3134' syntax error in insert into statement. I have been researching this all afternoon and most fixes refer to using reserved words but I don't see any. please look at this and see what you see.



    Code:
    Private Sub cmdsave_Click()
         Dim strsql As String
         strsql = " INSERT INTO RequestT (LocID, DeptID, SystemID, AssetID, ComponentID, HealthID, WorkID, Summary, Desc, PriorityID, RequestDate, CriticalID) " & _
                    "VALUES (" & Me.cboloc.Value & ",'" & Me.cbodept.Value & "','" & Me.cbosystem.Value & "','" & Me.cboasset.Value & "','" & Me.cbocomp.Value & "','" & Me.cbohealth.Value & "','" & Me.cbowork.Value & _
                    "','" & Me.txtsummary.Value & "','" & Me.txtdesc.Value & "','" & Me.cbopriority.Value & "','" & Me.txtdate.Value & "','" & Me.txtcrit.Value & "'); "
            Debug.Print (strsql)
         CurrentDb.Execute (strsql)
           
    End Sub
    the debug.print is getting all the values correctly. any thoughts?

  2. #2
    vicsaccess's Avatar
    vicsaccess is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    451
    ok, that's funny. someone mark this solved please. I just needed to ask for help and then it stood out to me. Desc needed to be bracketed. thanks all for the support. next time i'll wait on responces.

  3. #3
    CJ_London is online now VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    that's the problem with using reserved words as table or field names - you'll need to remember every time you use a query with this field. Better to change the name and not have to think about it again. Note Description is also a reserved word

  4. #4
    vicsaccess's Avatar
    vicsaccess is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    451
    thanks Ajax, hadn't thought of that. i'll change the field name. is there a list of reserved words?

  5. #5
    CJ_London is online now VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    this is a fairly up to date list

    https://support.office.com/en-us/art...7-da237c63eabe

    Note that it says using square brackets will solve the problem but in my experience, not always - an example that comes to mind is when referred to in conditional formatting

  6. #6
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    I like this link too, because it includes the application/program/utility that "reserves" the word, plus what the guru considers "problem" words.
    http://allenbrowne.com/AppIssueBadWord.html

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

Similar Threads

  1. Replies: 2
    Last Post: 08-22-2015, 11:26 AM
  2. runtime error 3134
    By TheLazyEngineer in forum Programming
    Replies: 2
    Last Post: 03-03-2015, 02:55 PM
  3. Syntax error 3134 for Add function
    By gaker10 in forum Programming
    Replies: 9
    Last Post: 06-16-2014, 12:06 PM
  4. Replies: 13
    Last Post: 06-12-2012, 09:52 PM
  5. Run-time Error '3134'
    By avitale in forum Access
    Replies: 2
    Last Post: 05-20-2012, 07:40 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