如何使用Access 2007解决在VBA中插入到语句中的运行时错误3134语法错误 [英] how to resolve run-time error 3134 syntax error in insert into statement in VBA using access 2007
问题描述
你好每一个我在insert into语句中都有语法错误这里是我的代码请帮帮我:(
Private Sub btn_add_tkn_Click()
query1 =INSERT INTO tkn_db ([f_name],[s_name],[file_no],[date_of_start],[cessation_date],[费用],[付款]&_
[帐户],[tax_return],[nature_of_employment ],[utr],[ni_number],[date_of_birth],[online_user_id]&_
[通过],[性别],[merital_status],[电话],[手机],[地址],[post_code],[reg_date],[notes])VALUES('&Me!f_name.Value _
&','&Me!s_name.Value _
&','&Me!file_no.Value _
&','&Me!start.Value _
&' ,'我!停止。价值_
&','和我!费用。价值_
&','和我!付款。价值_
&','和我!accounts.Value _
&','和我!tax_return.Value _
&','和我!nature_of_employment.V alue _
&','&Me!utr.Value _
&','&Me!ni_number.Value _
&',#和我!date_of_birth.Value _
&#,'和我!online_user_id.Value _
&',' &Me!pass.Value _
&','&Me!gender.Value _
&','&Me!merital_status.Value _
&',&我!telephone.Value _
&,&Me!mobile.Value _
&,' &Me!address.Value _
&','&Me!post_code.Value _
&',#&Me!reg_date.Value _
&#,'和我!notes.Value&')
Debug.Print query1
DoCmd.RunSQL query1, dbFailOnError
结束Sub
Hello every on i got syntax error in insert into statement here is my code please help me :(
Private Sub btn_add_tkn_Click()
query1 = "INSERT INTO tkn_db ([f_name], [s_name], [file_no], [date_of_start], [cessation_date], [fee], [payment] " & _
"[accounts], [tax_return], [nature_of_employment], [utr], [ni_number], [date_of_birth], [online_user_id] " & _
"[pass], [gender], [merital_status], [telephone], [mobile], [address], [post_code], [reg_date], [notes]) VALUES ('" & Me!f_name.Value _
& "', '" & Me!s_name.Value _
& "', '" & Me!file_no.Value _
& "', '" & Me!start.Value _
& "', '" & Me!cessation.Value _
& "', '" & Me!fee.Value _
& "', '" & Me!payment.Value _
& "', '" & Me!accounts.Value _
& "', '" & Me!tax_return.Value _
& "', '" & Me!nature_of_employment.Value _
& "', '" & Me!utr.Value _
& "', '" & Me!ni_number.Value _
& "', #" & Me!date_of_birth.Value _
& "#, '" & Me!online_user_id.Value _
& "', '" & Me!pass.Value _
& "', '" & Me!gender.Value _
& "', '" & Me!merital_status.Value _
& "', " & Me!telephone.Value _
& ", " & Me!mobile.Value _
& ", '" & Me!address.Value _
& "', '" & Me!post_code.Value _
& "', #" & Me!reg_date.Value _
& "#, '" & Me!notes.Value & "')"
Debug.Print query1
DoCmd.RunSQL query1, dbFailOnError
End Sub
推荐答案
我强烈建议你阅读 http://bobby-tables.com/about.html [ ^ ]并学习如何对代码进行一些基本的调试。
I strongly suggest you read http://bobby-tables.com/about.html[^], and also learn how to do some basic debugging of your code.
这篇关于如何使用Access 2007解决在VBA中插入到语句中的运行时错误3134语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!