【译文】如何使用自定义条件删除记录-周芳
Access软件网QQ交流学习群(群号码198465573),欢迎您的加入!
首页 >技术文章> 综合其它


【译文】如何使用自定义条件删除记录

发表时间:2013/11/19 8:13:30 评论(0) 浏览(6305)  评论 | 加入收藏 | 复制
   
摘 要:如何使用自定义条件删除记录
正 文:

来自:微软  翻译:周芳

【译文】如何使用自定义条件删除记录

      下面的例子illutrates展示了如何使用窗体的删除事件,防止删除一个符合自定义条件的记录。在这个例子中,如果DataRequired这个值的字段是肯定的则删除事件被取消。


VBA代码:

Private Sub Form_Delete(Cancel As Integer)
 
   ' 检查DataRequired字段的值.
    If Me.DataRequired = "Yes" Then
 
      ' 取消删除记录.
      Cancel = True
 
      ' 通知用户.
       MsgBox "Cannot Delete the Record."
    End If
End Sub

 

原文:How to: Cancel the Deletion of a Record by Using Custom Criteria

      The following example illutrates how to use a form's Delete event to prevent the deletion of a record based on custom criteria. In this example, the Delete event is canceled if the value of the DataRequired field is Yes.

 

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


Access软件网交流QQ群(群号:198465573)
 
 相关文章
【译文】如何从一个表中指定一个控件的值  【周芳  2013/9/3】
【译文】如果主窗体不包含记录,如何隐藏它的子窗体  【周芳  2013/9/10】
【译文】如何判断当前的记录在窗体里是否是一个新记录  【周芳  2013/10/18】
【译文】如何在保存一个记录前提示用户  【周芳  2013/10/29】
【译文】如何:提示用户在窗体中编辑数据前对数据的有效性确认  【周芳  2013/11/5】
常见问答
技术分类
相关资源
文章搜索
关于作者

周芳

文章分类

文章存档

友情链接