访问运行时错误3134

时间:2015-11-25 05:30:06

标签: sql vba ms-access

我有以下代码,我已阅读并在过去3小时内进行了更改,只是可以缝合以使其正常工作。

我得到的错误是“INSERT INTO语句中的语法错误”

Private Sub AddRecord_Click()

'Add the form details to the table

CurrentDb.Execute "INSERT INTO (Transactions (tDate,  category, transAmount, transDescription) " & _
    "VALUES & (" & _
    "'" & Me.txt_tDate & "', " & _
    "'" & Me.cmb_Category & "', " & _
    "'" & txt_TransAmount & "', " & _
    "'" & Me.txt_transDescription & "' " & _
    ")"


End Sub

表单上面有4个字段,默认情况下tDate设置为Date(),其他所有字符都设置为短文本或数字。

欢迎任何建议。

由于

2 个答案:

答案 0 :(得分:1)

删除此行中的第一个// 'table' is our implementation final NoSelectionModel<OurCustomDTOClass> editSelectedRowModel = new NoSelectionModel<OurCustomDTOClass>(); table.getTable().setSelectionModel(editSelectedRowModel, DefaultSelectionEventManager.createBlacklistManager(0)); table.addDomHandler(new DoubleClickHandler() { @Override public void onDoubleClick(final DoubleClickEvent event) { // code to open the popup to edit the record // this popup must be opened only if the user selects the rows and NOT the header } }, DoubleClickEvent.getType());

th

所以它是:

tr

答案 1 :(得分:0)

此外,几乎所有值都不是文本,因此:

"#" & Format(Me.txt_tDate, "yyyy\/mm\/dd") & "#, " & _
"'" & Me.cmb_Category & "', " & _
"" & Str(txt_TransAmount) & ", " & _
"'" & Me.txt_transDescription & "' " & _

其中Str将十进制值转换为带有点作为小数分隔符的字符串。

相关问题