完全删除事件中的记录 [英] Completely delete a record inan event

查看:84
本文介绍了完全删除事件中的记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我有一个表单,提供删除图像记录的命令按钮。但是,它仅删除图像的链接(图像描述),留下完整记录与该图像关联的所有其他字段。当用户搜索所有记录时,这就成了问题。他们得到一个Null图像屏幕,但描述(auther和date)仍然存在。我怎样才能完全删除整个记录。这是下面的代码。提前谢谢


私有子cmdErasePic_Click()

如果不是IsNull([imageFile])那么

如果MsgBox("这个图片将永久删除,你确定吗?",vbYesNo + vbQuestion)= vbYes然后

我!frmimagesubform.Form![imgPicture] .Picture =""

Me![imageFile] = Null

SysCmd acSysCmdClearStatus

致电Form_Current

结束如果

结束如果

结束Sub

解决方案


您好,


我有一个表单提供了一个擦除图像记录的命令按钮。但是,它仅删除图像的链接(图像描述),留下完整记录与该图像关联的所有其他字段。当用户搜索所有记录时,这就成了问题。他们得到一个Null图像屏幕,但描述(auther和date)仍然存在。我怎样才能完全删除整个记录。这是下面的代码。提前谢谢


私有子cmdErasePic_Click()

如果不是IsNull([imageFile])那么

如果MsgBox("这个图片将永久删除,你确定吗?",vbYesNo + vbQuestion)= vbYes然后

我!frmimagesubform.Form![imgPicture] .Picture =""

Me![imageFile] = Null

SysCmd acSysCmdClearStatus

致电Form_Current

结束如果

结束如果

End Sub

展开 | 选择 | Wrap | 行号


展开 | 选择 | Wrap | < span class =codeLinkonclick =LineNumbers(this);>行号


你好,


我试过把sql进入事件如下:


私有子cmdErasePic_Click()

如果不是IsNull([imageFile])那么

如果MsgBox(图像将被永久删除,你确定吗?,vbYesNo + vbQuestion)= vbYes那么

''我!frmimagesubform.Form![imgPicture] .Picture ="

''我![imageFile] = Null

''SysCmd acSysCmdC learStatus

DoCmd.SetWarnings False

Dim strSQL As String

''删除当前记录

mysql =" ; DELETE * FROM imageInventory其中imageInventory.imageID =" &安培;我![imageID]

DoCmd .RunSQL strSQL

''以某种方式移动记录指针

DoCmd.SetWarnings True

结束如果

结束如果

结束子


模块告诉我它不喜欢' 'Docmd。''请帮忙。感谢

Hello,

I have a form that provides a command button for an erase of a image record. However, it only removes the link (image description) to the image, leaving behind full record all the other fields associated with that image. This becomes a problem when a user is searching hrough all records. They get a Null image screen, but the description (auther and date) are still there. How can I completely remove that entire record instead. Here''s the code below. thanks in advance

Private Sub cmdErasePic_Click()
If Not IsNull([imageFile]) Then
If MsgBox("This image will be permanantly removed, Are you sure?", vbYesNo + vbQuestion) = vbYes Then
Me!frmimagesubform.Form![imgPicture].Picture = ""
Me![imageFile] = Null
SysCmd acSysCmdClearStatus
Call Form_Current
End If
End If
End Sub

解决方案

Hello,

I have a form that provides a command button for an erase of a image record. However, it only removes the link (image description) to the image, leaving behind full record all the other fields associated with that image. This becomes a problem when a user is searching hrough all records. They get a Null image screen, but the description (auther and date) are still there. How can I completely remove that entire record instead. Here''s the code below. thanks in advance

Private Sub cmdErasePic_Click()
If Not IsNull([imageFile]) Then
If MsgBox("This image will be permanantly removed, Are you sure?", vbYesNo + vbQuestion) = vbYes Then
Me!frmimagesubform.Form![imgPicture].Picture = ""
Me![imageFile] = Null
SysCmd acSysCmdClearStatus
Call Form_Current
End If
End If
End Sub

Expand|Select|Wrap|Line Numbers


Expand|Select|Wrap|Line Numbers


Hello,

I tried putting the sql into the event as follows:

Private Sub cmdErasePic_Click()
If Not IsNull([imageFile]) Then
If MsgBox("The image will be removed permanantly, are you sure?", vbYesNo + vbQuestion) = vbYes Then
''Me!frmimagesubform.Form![imgPicture].Picture = ""
''Me![imageFile] = Null
''SysCmd acSysCmdClearStatus
DoCmd.SetWarnings False
Dim strSQL As String
''DELETES the Current Record
mysql = "DELETE * FROM imageInventory Where imageInventory.imageID = " & Me![imageID]
DoCmd .RunSQL strSQL
''Move the Record Pointer IN some manner
DoCmd.SetWarnings True
End If
End If
End Sub

The module tells me it doesn''t like the ''Docmd.'' please help. thanks


这篇关于完全删除事件中的记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆