Access开发培训
网站公告
·Access专家课堂QQ群号:151711184    ·Access快速开发平台下载地址及教程    ·欢迎加入Access专家课堂微信群!    ·如何快速搜索本站文章|示例|资料    
您的位置: 首页 > 技术文章 > Access数据库-模块/函数/VBA

使用自定义条件取消删除记录

时 间:2021-03-19 20:08:49
作 者:杨雪   ID:42182  城市:南京
摘 要:下面的示例演示如何使用窗体的**Delete** 事件根据自定义条件防止删除记录。
正 文:

      在本示例中,如果 A 字段的值为"是",则会取消 Delete 事件。

图   示:


源   码:

Private Sub Form_Delete(Cancel As Integer)
' Check the value of the DataRequired field.
    If Me.A = "Yes" Then
 
      ' Cancel the record deletion.
      Cancel = True
 
      ' Notify the user.
       MsgBox "Cannot Delete the Record."
    End If
End Sub


Access软件网QQ交流群 (群号:483923997)       Access源码网店

常见问答:

技术分类:

相关资源:

专栏作家

关于我们 | 服务条款 | 在线投稿 | 友情链接 | 网站统计 | 网站帮助