删除记录 [英] deleting records

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

问题描述




我有一张表格,里面有一个子表格。我在

子表单中有一个删除按钮。我得到的代码是;


私人子cmdDeleteRecord_Click()


msg ="你确定要删除这部电影租赁记录?"

Style = vbYesNo + vbQuestion + vbDefaultButton2


Response = MsgBox(msg,Style,Film Rental Database)

如果Response = vbYes那么


DoCmd.RunSQL" UPDATE tblFilm SET tblFilm.Available = True WHERE FilmID =" &

Me.FilmID


Recordset.Delete

Else

MsgBox"你取消了删除操作


结束如果


结束子


所以当我舔删除按钮,我得到以下错误;

运行时错误3197

Microsoft Jet数据库引擎停止因为你和另一个用户是

试图同时更改相同的数据。

我怎么能克服这个错误,好像我关闭数据库,然后再打开它,

它会删除记录,并更新正确的字段?? (目前我已经按两次删除按钮来删除一条记录)


thanx

解决方案

如果您打开另一个显示相同

记录的表单,则会出现错误3197。你有另一张表格吗?


删除记录的一种简单方法是将以下代码放在你的任何字段的双

点击事件中形式:


DoCmd.SetWarnings False

DoCmd.RunCommand acCmdDeleteRecord

DoCmd.SetWarnings True


-

PC数据表

您的资源获取Access,Excel和Word应用程序的帮助

超过1125位用户来找我来自新闻组的请求帮助
re******@pcdatasheet.com

DP < DP@hotmail.com>在消息中写道

news:eK ****************** @ newsfe4-gui.ntli.net ...



我有一个表格,里面有一个子表格。我在
子窗体中有一个删除按钮。我得到的代码是;

私人子cmdDeleteRecord_Click()

msg ="你确定要删除这部电影租赁记录吗?"
Style = vbYesNo + vbQuestion + vbDefaultButton2

Response = MsgBox(msg,Style,Film Rental Database)
如果Response = vbYes那么

DoCmd。 RunSQL" UPDATE tblFilm SET tblFilm.Available = True WHERE FilmID =" &
Me.FilmID

Recordset.Delete

Else
MsgBox"您取消了删除操作

结束如果

结束Sub

所以当我点击删除按钮时,我收到以下错误;

运行时错误3197
<由于您和另一位用户正在尝试同时更改相同的数据,Microsoft Jet数据库引擎已停止。

如何克服此错误,就好像我关闭了DB,然后再打开它
它会删除记录,并更新正确的字段?? (目前我已经按两次删除按钮删除记录)

thanx



到原始海报:


人们普遍认为这些新闻组是免费交换

信息。请注意,PC数据表是一个臭名昭着的求职者。

如果你正在考虑与他做生意,那么我建议你先看看下面的链接

a。 > http://home.tiscali.nl/arracom /whoissteve.html

" PC数据表" <无**** @ nospam.spam>在消息中写道

news:jj ***************** @ newsread2.news.atl.earthl ink.net ...

如果您打开另一个显示相同
记录的表单,则会出现错误3197。你有另一个表格打开吗?

删除记录的一种简单方法是将以下代码放在表单上任何字段的
双击事件中:

DoCmd.SetWarnings False
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True

-
PC数据表
您的资源获取Access,Excel的帮助和Word应用程序
超过1125位用户来自新闻组请求帮助
re ****** @ pcdatasheet.com

" DP" < DP@hotmail.com>在消息中写道
新闻:eK ****************** @ newsfe4-gui.ntli.net ...

hi,

我有一个表格,里面有一个子表格。我在
子窗体中有一个删除按钮。我得到的代码是;

私人子cmdDeleteRecord_Click()

msg ="你确定要删除这部电影租赁记录吗?"
Style = vbYesNo + vbQuestion + vbDefaultButton2

Response = MsgBox(msg,Style,Film Rental Database)
如果Response = vbYes那么

DoCmd。 RunSQL" UPDATE tblFilm SET tblFilm.Available = True WHERE FilmID ="
& Me.FilmID

Recordset.Delete

Else
MsgBox"你取消了删除操作

结束如果

结束Sub

所以当我点击删除按钮时,我收到以下错误;

运行时错误3197

Microsoft Jet数据库引擎停止,因为你和另一个用户
正在尝试同时更改相同的数据。

如何克服此错误,就好像我关闭数据库,然后打开它
再次,
它会删除记录,并更新正确的字段?? (目前我已经按两次删除按钮删除记录)

thanx




好吧,我打开主窗体。它不显示相同的记录,

但它确实显示子窗体中的相同memberID。 (

wat i;我试图删除)


代码你怎么给我帮助?因为你必须双击每个

字段不会吗?


dev


" PC数据表" <无**** @ nospam.spam>在消息中写道

news:jj ***************** @ newsread2.news.atl.earthl ink.net ...

如果您打开另一个显示相同
记录的表单,则会出现错误3197。你有另一个表格打开吗?

删除记录的一种简单方法是将以下代码放在表单上任何字段的
双击事件中:

DoCmd.SetWarnings False
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True

-
PC数据表
您的资源获取Access,Excel的帮助和Word应用程序
超过1125位用户来自新闻组请求帮助
re ****** @ pcdatasheet.com

" DP" < DP@hotmail.com>在消息中写道
新闻:eK ****************** @ newsfe4-gui.ntli.net ...

hi,

我有一个表格,里面有一个子表格。我在
子窗体中有一个删除按钮。我得到的代码是;

私人子cmdDeleteRecord_Click()

msg ="你确定要删除这部电影租赁记录吗?"
Style = vbYesNo + vbQuestion + vbDefaultButton2

Response = MsgBox(msg,Style,Film Rental Database)
如果Response = vbYes那么

DoCmd。 RunSQL" UPDATE tblFilm SET tblFilm.Available = True WHERE FilmID ="
& Me.FilmID

Recordset.Delete

Else
MsgBox"你取消了删除操作

结束如果

结束Sub

所以当我点击删除按钮时,我收到以下错误;

运行时错误3197

Microsoft Jet数据库引擎停止,因为你和另一个用户
正在尝试同时更改相同的数据。

如何克服此错误,就好像我关闭数据库,然后打开它
再次,
它会删除记录,并更新正确的字段?? (目前我已经按两次删除按钮删除记录)

thanx




hi,

i''ve got a form, with a subform in it. i''ve got a delete button in the
subform. the code i;ve got is;

Private Sub cmdDeleteRecord_Click()

msg = "Are you sure you want to delete this film rental record?"
Style = vbYesNo + vbQuestion + vbDefaultButton2

Response = MsgBox(msg, Style, "Film Rental Database")
If Response = vbYes Then

DoCmd.RunSQL "UPDATE tblFilm SET tblFilm.Available =True WHERE FilmID=" &
Me.FilmID

Recordset.Delete
Else
MsgBox "You cancelled the delete operation"

End If

End Sub

so when i lcick the delete button, i get the following error;
runtime error 3197

The Microsoft Jet Database Engine stopped becasue you and another user are
attempting to change the same data at the same time.
how can i overcome this error, as if i close the DB, and then open it again,
it will delete the record, and update the correct field?? (currently i have
to press the delete button twice to delete a record)

thanx

解决方案

Error 3197 will occur if you have another form open that displays the same
record. Do you have another form open?

An easier way to delete a record is to put the following code in the double
click event of any field on your form:

DoCmd.SetWarnings False
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
Over 1125 users have come to me from the newsgroups requesting help
re******@pcdatasheet.com
"DP" <DP@hotmail.com> wrote in message
news:eK******************@newsfe4-gui.ntli.net...

hi,

i''ve got a form, with a subform in it. i''ve got a delete button in the
subform. the code i;ve got is;

Private Sub cmdDeleteRecord_Click()

msg = "Are you sure you want to delete this film rental record?"
Style = vbYesNo + vbQuestion + vbDefaultButton2

Response = MsgBox(msg, Style, "Film Rental Database")
If Response = vbYes Then

DoCmd.RunSQL "UPDATE tblFilm SET tblFilm.Available =True WHERE FilmID=" &
Me.FilmID

Recordset.Delete
Else
MsgBox "You cancelled the delete operation"

End If

End Sub

so when i lcick the delete button, i get the following error;
runtime error 3197

The Microsoft Jet Database Engine stopped becasue you and another user are
attempting to change the same data at the same time.
how can i overcome this error, as if i close the DB, and then open it
again,
it will delete the record, and update the correct field?? (currently i
have
to press the delete button twice to delete a record)

thanx



To the original poster:

It is commonly accepted that these newsgroups are for free exchange of
information. Please be aware that PC Datasheet is a notorious job hunter.
If you are considering doing business with him then I suggest that you take
a look at the link below first.

http://home.tiscali.nl/arracom/whoissteve.html
"PC Datasheet" <no****@nospam.spam> wrote in message
news:jj*****************@newsread2.news.atl.earthl ink.net...

Error 3197 will occur if you have another form open that displays the same
record. Do you have another form open?

An easier way to delete a record is to put the following code in the double click event of any field on your form:

DoCmd.SetWarnings False
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
Over 1125 users have come to me from the newsgroups requesting help
re******@pcdatasheet.com
"DP" <DP@hotmail.com> wrote in message
news:eK******************@newsfe4-gui.ntli.net...

hi,

i''ve got a form, with a subform in it. i''ve got a delete button in the
subform. the code i;ve got is;

Private Sub cmdDeleteRecord_Click()

msg = "Are you sure you want to delete this film rental record?"
Style = vbYesNo + vbQuestion + vbDefaultButton2

Response = MsgBox(msg, Style, "Film Rental Database")
If Response = vbYes Then

DoCmd.RunSQL "UPDATE tblFilm SET tblFilm.Available =True WHERE FilmID=" & Me.FilmID

Recordset.Delete
Else
MsgBox "You cancelled the delete operation"

End If

End Sub

so when i lcick the delete button, i get the following error;
runtime error 3197

The Microsoft Jet Database Engine stopped becasue you and another user are attempting to change the same data at the same time.
how can i overcome this error, as if i close the DB, and then open it
again,
it will delete the record, and update the correct field?? (currently i
have
to press the delete button twice to delete a record)

thanx




well yea, i have the main form open. it does not display the same record,
but it does display the same membershipID which is in the subform. (which is
wat i;m trying to delete)

how would the code u gave me help? as u would have to double click each
field wouldnt u?

dev

"PC Datasheet" <no****@nospam.spam> wrote in message
news:jj*****************@newsread2.news.atl.earthl ink.net...

Error 3197 will occur if you have another form open that displays the same
record. Do you have another form open?

An easier way to delete a record is to put the following code in the double click event of any field on your form:

DoCmd.SetWarnings False
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
Over 1125 users have come to me from the newsgroups requesting help
re******@pcdatasheet.com
"DP" <DP@hotmail.com> wrote in message
news:eK******************@newsfe4-gui.ntli.net...

hi,

i''ve got a form, with a subform in it. i''ve got a delete button in the
subform. the code i;ve got is;

Private Sub cmdDeleteRecord_Click()

msg = "Are you sure you want to delete this film rental record?"
Style = vbYesNo + vbQuestion + vbDefaultButton2

Response = MsgBox(msg, Style, "Film Rental Database")
If Response = vbYes Then

DoCmd.RunSQL "UPDATE tblFilm SET tblFilm.Available =True WHERE FilmID=" & Me.FilmID

Recordset.Delete
Else
MsgBox "You cancelled the delete operation"

End If

End Sub

so when i lcick the delete button, i get the following error;
runtime error 3197

The Microsoft Jet Database Engine stopped becasue you and another user are attempting to change the same data at the same time.
how can i overcome this error, as if i close the DB, and then open it
again,
it will delete the record, and update the correct field?? (currently i
have
to press the delete button twice to delete a record)

thanx




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

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