Access 2003 Runtime Error 3134
Contents |
Community Links Social Groups Pictures & Albums Members List Calendar Search Forums Show Threads Show Posts Tag Search Advanced Search Find All runtime error 3134 access vba Thanked Posts Go to Page... Page 1 of 2 1 2
Runtime Error 3134 Insert Into Statement
> Thread Tools Rating: Display Modes 12-08-2009, 12:09 PM #1 AccessNewbie73 Newly Registered User Join run time error 3134 access vba Date: Dec 2009 Posts: 5 Thanks: 0 Thanked 0 Times in 0 Posts Run-time error 3134, Syntax error INSERT INTO Hello everyone, I'm venturing into my first attempts at ms access runtime error sql and am getting a "Run-time error '3134': Syntax error in INSERT INTO statement. Here's the code below. Any suggestions?? Private Sub cmdSaveLabRequest_Click() Dim strCriteria As String Dim strSQL As String If Me.unbOrderedBy = "" Then MsgBox (" Ordered By field cannot be blank") Else If Me.cmbMinistry = "Select Ministry" Then MsgBox (" Select Ministry") Else DoCmd.SetWarnings False DoCmd.RunSQL
Ms Access Runtime Error 91
"INSERT INTO tblOSHWALabRequests (Candidate, ApplicantID, Req, StartDate, DOB, Position, PL-Dept, Ministry, DateLabsOrdered, OrderedBy, AllNewHireLabs, QuantiferonGold, RubeollaAntibody, RubellaAntibody, MumpsTiter, HepBSurfAntigen, UrineDrug, LeadLabTests, BloodLead, ZincProtoporphyrin, LeadCBCDiff, OncLabTests, OncCBCDiff, CMBP, SGPT, DCProviderLabTests, DCCBCDiff, MiscLabTests, VaricellaAntibody, UAHCG,) Values (cmbCandidate, unbApplicantID, unbReq, unbStartDate, unbDOB, unbPosition, unbPLDept, cmbMinistry, unbDateOrdered, unbOrderedBy, unbAllLabs, unbAllTests1, unbAllTests2, unbAllTests3, unbAllTests4, unbAllTests5, unbAllTests6, unbPBTests, unbPBTest1, unbPBTest2, unbPBTest3, OncTests, OncTest1, OncTest2, OncTest3, OncTest4, unbDCProvidersTests, unbDCProvidersTest1, unbMiscTests, unbMiscTest1, unbMiscTest2)" End If End If Me.Refresh DoCmd.SetWarnings True End Sub AccessNewbie73 View Public Profile Find More Posts by AccessNewbie73 12-08-2009, 01:15 PM #2 JANR Newly Registered User Join Date: Jan 2009 Location: Norway Posts: 1,617 Thanks: 7 Thanked 161 Times in 154 Posts Re: Run-time error 3134, Syntax error INSERT INTO Point 1 All SQL has to be on one string, for long SQL statements breake it up in pieces to be more readeble, if your code is as you posted it. Then add a linecontinue at the end of the individuelle lines. Code: ....OrderedBy, & _ A better way is to build it up g
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 ms access runtime error 5 more about Stack Overflow the company Business Learn more about hiring developers or posting ms access runtime error 13 type mismatch ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community
Ms Access Runtime Error 2105
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Runtime Error 3134 - Syntax Error in INSERT INTO Statement http://www.access-programmers.co.uk/forums/showthread.php?t=184817 up vote 0 down vote favorite I'm trying to fix it about hour but it's not work Please help me :( CurrentDb.Execute "INSERT INTO match_day( home_team, away_team, date, time, home_score, away_score, stadium) " & _ " VALUES('" & Me.textHT & "','" & Me.textAT & "',#" & Me.textDATE & "#,#" & Me.textTime & "#," & Me.textHS & "," & Me.textAS & ",'" & Me.textSTD & ",')" ms-access share|improve this question http://stackoverflow.com/questions/27659251/runtime-error-3134-syntax-error-in-insert-into-statement asked Dec 26 '14 at 16:03 user3071071 32 add a comment| 2 Answers 2 active oldest votes up vote 3 down vote Are the fields for date and time considered reserved words and should be wrapped in brackets or ticks to qualify it as the column name... ..., [date], [time], ... But I think it is most likely the trailing final comma before your final closing ) of the inserted values making it look like it wants another field to be inserted. Me.textSTD & ",')" change to Me.textSTD & "')" share|improve this answer answered Dec 26 '14 at 16:06 DRapp 32.5k74597 Not to mention it's vulnerable to SQL injection. –Ben McIntyre Dec 29 '14 at 9:33 add a comment| up vote 0 down vote I ran into a similar error - thanks to this post I realised that I had used a reserved name "note" in a table ( instead of "notes"). StrSQL = "INSERT INTO option_notes ( OPTION_ID , USER_ID , [NOTE] ) VALUES ( " & currID & " , " & currUserID & " , '" & currNote & "' ) ; " CurrentDb.Execute StrSQL I ended up changing the field name - however, wrapping the field name
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and http://stackoverflow.com/questions/19044138/showing-run-time-error-3134-in-access-from policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags http://www.tek-tips.com/viewthread.cfm?qid=1674867 Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only time error takes a minute: Sign up showing run time error 3134 in access from up vote 0 down vote favorite it is giving me an run time error 3134 syntax error in insert into statement while clicking on the control. Private Sub CmdAddNew_Click() 'add data to table CurrentDb.Execute "INSERT INTO tblemployee(,firstname,lastname,Address,city)" & _ "VALUES('" & Me.txtfirstname & "','" & Me.txtlastname & "','" ms access runtime & Me.txtaddress & "','" & Me.txtcity & "')" vba ms-access access-vba share|improve this question asked Sep 27 '13 at 6:32 keval kumar 52 2 You have an SQL injection problem there. What will happen if txtlastname is "O'Hara"? –Anders Lindahl Sep 27 '13 at 6:42 add a comment| 1 Answer 1 active oldest votes up vote 0 down vote accepted tblemployee(,firstname Extra comma here? share|improve this answer answered Sep 27 '13 at 6:41 sam092 1,173157 i have removed the extra comma , it is not giving me error but the control is not working @sam092 –keval kumar Sep 27 '13 at 6:48 add dbFailOnError as second parameter n call of Execute –4dmonster Sep 27 '13 at 7:13 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and terms of service. Not the answer
Join INTELLIGENT WORK FORUMSFOR COMPUTER PROFESSIONALS Log In Come Join Us! Are you aComputer / IT professional?Join Tek-Tips Forums! Talk With Other Members Be Notified Of ResponsesTo Your Posts Keyword Search One-Click Access To YourFavorite Forums Automated SignaturesOn Your Posts Best Of All, It's Free! Join Us! *Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail. Posting Guidelines Promoting, selling, recruiting, coursework and thesis posting is forbidden.Tek-Tips Posting Policies Jobs Jobs from Indeed What: Where: jobs by Link To This Forum! Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.Just copy and paste the BBCode HTML Markdown MediaWiki reStructuredText code below into your site. Microsoft: Access Forms Forum at Tek-Tips HomeForumsProgrammersDBMS PackagesMicrosoft: Access Forms Forum Runtime Error 3134 Syntax Error in INSERT INTO statement 2 thread702-1674867 Forum Search FAQs Links MVPs Runtime Error 3134 Syntax Error in INSERT INTO statement Runtime Error 3134 Syntax Error in INSERT INTO statement daveinchicago (IS/IT--Management) (OP) 13 Feb 12 17:46 I can't for the life of me figure this out.The syntax looks good to me.Any help would be appreciated.thanksCurrentDb.Execute "Insert Into RulesNotCrD(AccountName, Note) Values ('" & Me.cboAcName & "','" & Me.Text18 & "')" RE: Runtime Error 3134 Syntax Error in INSERT INTO statement PHV (MIS) 13 Feb 12 18:22 What about this ?CODECurrentDb.Execute "INSERT INTO RulesNotCrD(AccountName,Note) VALUES ('" & Replace(Me.cboAcName, "'", "''") & "','" & Replace(Me.Text18, "'", "''") & "')" Hope This Helps, PH.FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?FAQ181-2886: How can I maximize my chances of getting an answer? RE: Runtime Error 3134