查看: 1295|回复: 5
|
Microsoft Access 2003 的问题
[复制链接]
|
|
請問如何讓textbox 的 value, insert into database ?
When user click save 所有的textbox value will insert into database. 以下是coding..為何it wont work ?
Private Sub CommandSave_Click()
Dim Current As String
Current = "Insert Into FollowUp Values("&text1","&text2","&text3","&text4")
Exit_CommandSave_Click:
Exit Sub
End Sub |
|
|
|
|
|
|
|
发表于 14-6-2007 12:48 AM
|
显示全部楼层
你的 Current 只是包含 sql statement, 当然不会有什么行动.
两个简单的方法, 可以用 Access 的 Wizard 来自动建立一个 insert button, 不然用 docmd.RunSQL 来执行以上你的 sql. |
|
|
|
|
|
|
|
发表于 14-6-2007 12:50 AM
|
显示全部楼层
另外, 你的 sql 也写错了, 少放了 &, 再自行检查一下. |
|
|
|
|
|
|
|

楼主 |
发表于 14-6-2007 07:06 PM
|
显示全部楼层
原帖由 goatstudio 于 14-6-2007 12:48 AM 发表
你的 Current 只是包含 sql statement, 当然不会有什么行动.
两个简单的方法, 可以用 Access 的 Wizard 来自动建立一个 insert button, 不然用 docmd.RunSQL 来执行以上你的 sql.
here is my code why still cannot execute?
Private Sub Command13_Click()
Dim Current As String
Current = "Insert Into FollowUp Values(&Text4,&text6,&text8,&text10)"
DoCmd.RunSQL (Current)
Exit_Command13_Click:
Exit Sub
End Sub |
|
|
|
|
|
|
|

楼主 |
发表于 14-6-2007 07:08 PM
|
显示全部楼层
原帖由 goatstudio 于 14-6-2007 12:50 AM 发表
另外, 你的 sql 也写错了, 少放了 &, 再自行检查一下.
少放了& ?? where? actually this is my first time use vba not really noe  |
|
|
|
|
|
|
|
发表于 15-6-2007 01:20 AM
|
显示全部楼层
原帖由 html 于 14-6-2007 07:08 PM 发表
少放了& ?? where? actually this is my first time use vba not really noe
Current = "Insert Into FollowUp Values( '" & Text4 & "', '" & text6 & "', '" & text8 & "', '" & text10 & ')"
|
|
|
|
|
|
|
| |
本周最热论坛帖子
|