Ms Access Vba Run Time Error 3134
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers run time error 3134 insert into statement or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x 3134 error access Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it runtime error 3061 only takes a minute: Sign up Runtime Error 3134 - Syntax Error in INSERT INTO Statement (MS Access VBA) up vote 0 down vote favorite I changed the input on the data table and added the "from" and "to" to the table and the query, however now I get the error Runtime Error 3134 - Syntax Error in INSERT INTO Statement My statement: db.Execute "INSERT INTO Temp ( LoadNum, ReferenceNum, ActivityDate, Appointment, From, To, OriginCity, OriginCountry, DestinationCity, DestinationCountry, [Carrier Name], [Load Status] ) " _ & "SELECT Data.LoadNum, Data.ReferenceNum, Data.ActivityDate, Data.Appointment, Data.From, Data.To, Data.OriginCity, Data.OriginCountry, Data.DestinationCity, Data.DestinationCountry, Data.[Carrier Name], Data.[Load Status] " _ & "FROM Data " _ & "WHERE [Data].[CarrierCode]='" & cNum & "';" I've been staring at this for a while, but i cannot find the error. Does anyone have an idea? vba ms-access share|improve this question edited Mar 30 '15 at 9:18 Jean-Francois Corbett 24k1678113 asked Mar 30 '15 at 8:56 eelc016 1 Can you take a moment to apply style formatting to your codes? stackoverflow.com/editing-help –James Wong Mar 30 '15 at 9:03 Syntax Error is usually just a typo in your query. I have had this probem many times. The best procedure is to start with a very simple version of the query and then adding the other parts step by step while trying it out everytime. This way you can pinpoint the probelematic part. –mernerp Mar 30 '15 at 9:20 add a comment| 1 Answer 1 active oldest votes up vote 0 down vote You probably need wrap at least these reserved words in brackets: .., [From], [To], .. Full list: Reserved words in Access SQL share|improve this answer edited Mar 30 '15 at 13:09 answered Mar 30 '15 at 9:32 Gustav 12.8k21026 This was exactly the issue! Is there an overview online to know what the reserved words within VBA are? –eelc016 Mar 30 '15 at 11:07 Yes. Just bing for it. –Gustav Mar 30 '15 at 13:09 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign u
Social Groups Pictures & Albums Members List Calendar Search Forums Show Threads Show Posts Tag Search Advanced Search Find All Thanked Posts Go to Page... Thread Tools Rate Thread Display Modes 03-01-2010, 12:42 PM #1 AndyCabbages Registered User Join Date: Feb 2010 Posts: 74 Thanks: 0 Thanked 0 Times in 0 Posts Run-time error '3134' I am getting the following error: Run-time error '3134' Syntax error in INSERT INTO statement This is the piece of code I am directed to: Private Function addSuite() If suiteName = "" Or Description = "" Then MsgBox "Please enter a name and description for this suite!" Else If equip1 = "" Or equip2 = "" Then MsgBox "Please make sure that the first two items are selected!" Else If DayPrice = http://stackoverflow.com/questions/29342031/runtime-error-3134-syntax-error-in-insert-into-statement-ms-access-vba "" Or WeekPrice = "" Then MsgBox "Make sure you have entered a day price and a week price for this suite!" Else addSQL = "INSERT INTO suites (Name, Description, Day_Price, Week_Price, Item1, Item2, Item3, Item4, Item5, Item6, Insurance_Value, Weight) Values ('" & suiteName & "', '" & Description & "', " & DayPrice & ", " & WeekPrice & ", '" & equip1 & "', '" & equip2 & "', '" & equip3 & "', '" & equip4 & "', '" & equip5 http://www.access-programmers.co.uk/forums/showthread.php?t=189178 & "', '" & equip6 & "', '" & IValue & "', '" & GrossWeight & "')" DoCmd.RunSQL (addSQL) DoCmd.Close End If End If End If End Function The debugger suggests that the error is on the line: DoCmd.RunSQL (addSQL) Any suggestions? I really dont know much about visual basic and cant make such sense of the above piece of code. Andy AndyCabbages View Public Profile Find More Posts by AndyCabbages 03-01-2010, 12:44 PM #2 SOS Registered Lunatic Join Date: Aug 2008 Location: Somewhere between here and there Posts: 3,520 Thanks: 2 Thanked 54 Times in 52 Posts Re: Run-time error '3134' Well, one thing jumps out at me right away. You have a field name (NAME) which is an Access Reserved Word and that is not good. You WILL have to use square brackets around it like [Name] EVERY PLACE you use it. I would suggest renaming that field and going on as NAME can be a very bad, very bad reserved word to use. SOS View Public Profile Find More Posts by SOS 03-01-2010, 01:04 PM #3 ghudson Newly Registered User Join Date: Jun 2002 Location: USA Posts: 6,199 Thanks: 1 Thanked 74 Times in 43 Posts Re: Run-time error '3134' Try printing the sql and see what you get when you paste that into a query. Add this to the end of your code and see what is printed in the Immedi
Forums Microsoft Access Run-Time Error 3134 - Syntax Error in Insert Into Statement Results 1 to 5 of 5 Run-Time Error 3134 - Syntax Error in http://www.mrexcel.com/forum/microsoft-access/753645-run-time-error-3134-syntax-error-insert-into-statement.html Insert Into StatementThis is a discussion on Run-Time Error 3134 - Syntax Error in Insert Into Statement within the Microsoft Access forums, part of the Question Forums category; Hi - I have an Insert Into Statement in my VBA code and I keep getting a run-time error 3134. ... LinkBack LinkBack URL About LinkBacks Bookmark & Share Digg this Thread!Add Thread time error to del.icio.usBookmark in TechnoratiTweet this thread Thread Tools Show Printable Version Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Jan 28th, 2014,02:09 PM #1 davidb88 Board Regular Join Date Sep 2013 Posts 75 Run-Time Error 3134 - Syntax Error in Insert Into Statement Hi - I have an Insert Into Statement in my VBA code and I keep getting a run time error run-time error 3134. I know there are a number of posts about this type of problem and I have tried all of the solutions I have found but nothing seems to work for this particular string. If someone sees the issue, can you please point it out? Thanks. Code: strSQL = "INSERT INTO tblPDcalc ([Month End], [Loan Type], [FICO Band], [r1PD], [r2PD], [r3PD], [r4PD], [r5PD], " _ & "SELECT (#" & modeldate & "#, '1st Mtg', '1', " _ & " " & r1PD & ", " & r2PD & ", " & r3PD & ", " & r4PD & ", " & r5PD & ");" DoCmd.RunSQL (strSQL) Share Share this post on Digg Del.icio.us Technorati Twitter Reply With Quote Jan 28th, 2014,02:35 PM #2 mole999 Moderator Join Date Oct 2004 Location UK Posts 6,820 Re: Run-Time Error 3134 - Syntax Error in Insert Into Statement double speech marks on beginning of line three look suspicious to me Share Share this post on Digg Del.icio.us Technorati Twitter Yes I know there are better ways to do it. I just wish I knew them. - 2