问题删除 [英] Problem deleting

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

问题描述




我正在运行Access 2002并且在

连续表单上删除记录时出现问题。

我以为这可能是由于与其他两个桌子的关系,但

删除了这些关系,我仍然无法删除

记录。


我使用的代码如下: -


yn = MsgBox(你确定要删除所有这些人的详细信息

永久?? ??,vbYesNo,"保存")

如果yn = vbNo那么

MsgBox("记录未删除")

Else


DoCmd.DoMenuItem acFormBar,acEditMenu,8 ,, acMenuVer70

DoCmd.DoMenuItem acFormBar,acEditMenu,6 ,, acMenuVer70

结束如果

有人能看错吗?


Yvonne

解决方案

你不知道你的代码在哪里,但我猜你有一个

逗号nd按钮。如果是这样的话,我认为问题是当你点击按钮时,你已经把焦点从你想要的记录上移开了

删除所以在连续表格上没有当前记录,并且没有a / b
当前记录,Access不知道您要删除哪条记录!尝试

将代码放在您的某个控件的DoubleClick事件中,比如

人的名字,双击该控件,然后查看它是否有效。


-

总有不止一种方法给猫皮肤!


基于答案/帖子在Access 2000上


通过AccessMonster.com发布的消息
http://www.accessmonster.com/Uwe/For...ccess/200612/1




missinglinq通过AccessMonster.com写道:


你不能说你在哪里有这个代码,但我猜你有一个

命令按钮。如果是这样的话,我认为问题是当你点击按钮时,你已经把焦点从你想要的记录上移开了

删除所以在连续表格上没有当前记录,并且没有a / b
当前记录,Access不知道您要删除哪条记录!尝试

将代码放在您的某个控件的DoubleClick事件中,比如

人的名字,双击该控件,然后查看它是否有效。


-

总有不止一种方法给猫皮肤!


基于答案/帖子在Access 2000上


通过AccessMonster.com发布的消息
http://www.accessmonster.com/Uwe/For...ccess/200612/1



是的,它在命令按钮后面。一个相邻的按钮打开一个

单独的表格(frmDetails),其中包含记录的完整详细信息。

和frmDetails打开。


我尝试了双击事件,但是没有用。


我查了一下,连续表单允许编辑和删除。


我放了一个命令按钮来删除frmDetails上的记录,但是

也没用。


很奇怪,是吧? />

Yvonne



> Yvonne写道:


我放了一个命令按钮来删除frmDetails上的记录,但是

也不起作用。


奇怪,是吧?


Yvonne



更新....


当我接受这个代码时,它必须与这个代码有关

out,删除通过OK。

frmDetals上的简单删除命令按钮也可以正常工作。


yn = MsgBox(你确定要删除这个人的所有细节吗?

永久?? ??,vbYesNo,"保存")

如果yn = vbNo那么

MsgBox(" record not deleted" )

Else


这有帮助吗?


Yvonne


Hi,

I''m running Access 2002 and have a problem deleting records on a
continuous form.
I thought it might be due to relationships with two other tables but
having deleted these relationships, I''m still not able to delete a
record.

The code I am using is as follows:-

yn = MsgBox("Are you sure to delete all this person''s details
permanently??", vbYesNo, "Save")
If yn = vbNo Then
MsgBox ("record not deleted")
Else

DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
End If
Can anyone see anything wrong?

Yvonne

解决方案

You don''t say where you have this code, but I''m guessing you have it behind a
command button. If that''s the case, I think the problem is that when you
click on the button, you''ve taken focus away from the record you want to
delete so there is, on a continuous form, no current record, and without a a
current record, Access doesn''t know which record you want to delete! Try
placing the code in the DoubleClick event of one of your controls, say the
person''s name, doubleclick that control, and see if it works.

--
There''s ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200612/1



missinglinq via AccessMonster.com wrote:

You don''t say where you have this code, but I''m guessing you have it behind a
command button. If that''s the case, I think the problem is that when you
click on the button, you''ve taken focus away from the record you want to
delete so there is, on a continuous form, no current record, and without a a
current record, Access doesn''t know which record you want to delete! Try
placing the code in the DoubleClick event of one of your controls, say the
person''s name, doubleclick that control, and see if it works.

--
There''s ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200612/1

Yes it''s behind a command button. An adjacent button that opens up a
separate form ( frmDetails) with full details of the record works OK
and frmDetails opens up.

I tried the double-click event proceedure but that didn''t work.

I checked and the continuous form allows Edits and Deletions.

I put a command button to delete the record on frmDetails but that
didn''t work also.

Weird, huh?

Yvonne


>Yvonne wrote:

I put a command button to delete the record on frmDetails but that
didn''t work also.

Weird, huh?

Yvonne

Update....

It''s got to be something to do with this code becuse when I take it
out, the delete goes through OK. And a simple delete command button on
frmDetals works OK also.

yn = MsgBox("Are you sure to delete all this person''s details
permanently??", vbYesNo, "Save")
If yn = vbNo Then
MsgBox ("record not deleted")
Else

Does this help?

Yvonne


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

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