+ Reply to Thread
Results 1 to 5 of 5

SQL INSERT INTO -runtime error 3134

  1. #1
    Forum Contributor
    Join Date
    04-21-2010
    Location
    Canada
    MS-Off Ver
    Office 2013
    Posts
    120

    SQL INSERT INTO -runtime error 3134

    Sorry if this is a repeat post, but it seems that my other post (yesterday) disappeared...

    in anycase, a recap. I am trying to add a record to an ODBC linked table on my SQL database. Looking on line, it sounds that using SQL INSERT INTO is the best way to go with this. Problem is I am getting an error 3134. I looked around for an hour or so, as there are various causes for this error, but none seemed to point to what I may be doing wrong. I have though tried to adopt the what has been told to others. here is the code (and commented out old code):
    Please Login or Register  to view this content.
    a few questions on this as well. Here I listed off all the fields and (tried) to throw data into all of them. Is it possible to just populate one field and the rest would be null? (in this case all fields need to be populated)
    Last edited by jik_ff; 04-01-2014 at 11:27 AM. Reason: Solved

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: SQL INSERT INTO -runtime error 3134

    I think it's just a syntax problem, probably caused by a typo.

    Try replacing (( before LocCode with (.
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    04-21-2010
    Location
    Canada
    MS-Off Ver
    Office 2013
    Posts
    120

    Re: SQL INSERT INTO -runtime error 3134

    Crap... Well ok, got that out. Too much copy pasting I guess. Ok. So that is no longer the error, but now I am getting 3061, Too few Parameters. Expected 1. on the same CurrentDB.Execute strSQL line.

    I think it has to do with how I am trying to get my variable data into the SQL string. Specificall this line:

    strSQL = strSQL & "(newStr, 'Address1', 'Address2', 'City', 'StateProv', 'PostalZip', 'PhoneNo', 'FaxNo')"


    newStr is a variable, where as the other items are text. Do I have to format it specifically with a variable (that is a string)?


    EDIT: I know I am on the right track, if I change the newStr to text (putting 's around it) it works... Just need the right syntax for this...
    Last edited by jik_ff; 04-01-2014 at 10:54 AM.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: SQL INSERT INTO -runtime error 3134

    To incorporate the variable in the SQL try this.
    Please Login or Register  to view this content.
    By the way, a good way to test the SQL is to print it to the immediate window like this.
    Please Login or Register  to view this content.
    You can the copy what's been output, paste it in the SQL view of a query and try to execute it.

    If the syntax is right you should get a warning about changing/updating records and the option to cancel.

  5. #5
    Forum Contributor
    Join Date
    04-21-2010
    Location
    Canada
    MS-Off Ver
    Office 2013
    Posts
    120

    Re: SQL INSERT INTO -runtime error 3134

    Awsome. Thanks for the tip. I new it had something to do with the & symbols...

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Insert Row Macro - runtime error
    By radddogg in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-25-2011, 08:44 AM
  2. Runtime error 1004: Insert method of Range class failed......not sure why
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-21-2011, 02:15 PM
  3. Insert Pic Intermittent runtime error
    By vamosj in forum Access Programming / VBA / Macros
    Replies: 0
    Last Post: 04-19-2009, 07:01 AM
  4. Runtime 1004 error when insert.
    By mikewild2000 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-08-2006, 06:48 PM
  5. Runtime 1004 error when insert.
    By mikewild2000 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-08-2006, 03:21 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1