运行时错误"3075" 查询表达式"id="中的语法错误(缺少运算符)



我正在尝试创建将执行软删除的脚本。显然,我在运行脚本后遇到了运行时错误。请帮忙。

Private Sub cmdDelete_Click()
Dim db As DAO.Database
    'delete record
    'check existing selected record
    'If Not (Me.frmGatewaySub.Form.Recordset.EOF And Me.frmGatewaySub.Form.Recordset.BOF) Then
        'confirm deletion
        If MsgBox("Are you sure you want to soft delete this?", vbYesNo) = vbYes Then
            'soft delete now
            Set db = CurrentDb
            Call db.Execute( _
                "Update dbo_gateway" & _
                " set deleted_at= now()" & _
                " where id=" & Me.txtID.Value, dbSeeChanges)
            'clear text box
            cmdClear_Click
            Me.frmGatewaySub.Form.Requery
        End If
    'End If
End Sub

文本框为空,因此:

" where id=" & Me.txtID.Value, dbSeeChanges)

成为:

" where id="

因此,请仔细检查您的代码,并在 txtID 为 Null 时阻止它运行。

相关内容

  • 没有找到相关文章

最新更新