删除邮件 - 可以选择性地关闭吗? [英] Delete message - Can is selectively be turned off?
问题描述
感谢您花时间阅读我的问题!!
我正在使用的代码会自动删除字段中的数据行
和当然,当你这样做时,Access会提示你,你需要删除x行数
。
大多数时候我想要这个消息是显示。我可以使用代码
来删除指定的行并且不给出消息吗?
这是我正在使用的代码:
将SQLDelete作为字符串调暗
SQLDelete ="从EquipID =设备中删除 &安培; Me.List_Device
DoCmd.RunSQL SQLDelete
谢谢
N. Graves >
您可以通过以下方式避免消息:
DoCmd.SetWarnings False
但是,你不知道动作查询是否有任何问题。
以下方法更好,因为只有在出现
问题时才会给出消息:
dbEngine(0)(0)。执行strSQL,dbFailOnError
如果你的动作查询需要一个全有或全无的结果,你可以在事务中包装
整个事物。文章中的示例:
存档:将记录移至另一个表格
at:
http://allenbrowne.com/ser-37.html
-
Allen Browne - 微软MVP。西澳大利亚州珀斯。
访问用户提示 - http:// allenbrowne.com/tips.html
回复群组,而不是mvps dot org的allenbrowne。
" N.格雷夫斯QUOT; <纳克***** @ REMOVEyahoo.com>在消息中写道
新闻:nq ******************************** @ 4ax.com ...感谢您花时间阅读我的问题!!
我正在使用会自动删除字段中数据行的代码
当然,当你这样做时,Access会提示你即将删除x行。
大多数时候我想要显示这条消息。我可以使用代码删除指定的行并不提供消息吗?
这是我目前正在使用的代码:
Dim SQLDelete As字符串
SQLDelete ="从EquipID =设备中删除 &安培; Me.List_Device
N / G> < >尝试像这样包装DoCmd
Application.SetOption确认记录更改,错误
Application.SetOption确认文档删除 ,False
Application.SetOption" Confirm Action Queries",False
DoCmd.RunSQL SQLDelete
Application.SetOption" Confirm Record Changes" ,True
Application.SetOption确认文档删除,确认
Application.SetOption确认操作查询,确认
i全部使用全部在分配运行时间时关闭所有内容的三条线因为
i不想要用来摆弄它们
你可能会发现你不需要所有三个行和只是
Application.SetOption确认操作查询,错误
DoCmd.RunSQL S QLDelete
Application.SetOption确认操作查询,真实
会做什么
希望这有助于
Dave
" N.格雷夫斯QUOT; <纳克***** @ REMOVEyahoo.com>在消息中写道
新闻:nq ******************************** @ 4ax.com ...感谢您花时间阅读我的问题!!
我正在使用会自动删除字段中数据行的代码
当然,当你这样做时,Access会提示你即将删除x行。
大多数时候我想要显示这条消息。我可以使用代码删除指定的行并不提供消息吗?
这是我目前正在使用的代码:
Dim SQLDelete As字符串
SQLDelete ="从EquipID =设备中删除 &安培; Me.List_Device
N / G> < >嗨N,
尝试使用执行方法(DAO),但一定要包含dbFailOnError
选项。 />
像这样:
....
Dim MyDB作为DAO.Database
设置MyDB = CurrentDB
将SQLDelete作为字符串调暗
SQLDelete ="从EquipID ="的设备中删除&安培; Me.List_Device
MyDB.Execute SQLDelete,dbFailOnError
设置MyDB = Nothing
....
-
HTH,
Don
========== ===================
使用我的** ***@Telus.Net 用于发送电子邮件
免责声明:
Professional PartsPerson
业余数据库程序员{:o)
我是Access97用户,所以所有发布的代码
样本也是基于Access97的
除非另有说明。
Do SinksIn = True
文件/保存,<书桌抽屉里的手指敲打>
循环
================================
" N.格雷夫斯QUOT; <纳克***** @ REMOVEyahoo.com>在消息中写道
新闻:nq ******************************** @ 4ax.com ...感谢您花时间阅读我的问题!!
我正在使用会自动删除字段中数据行的代码
当然,当你这样做时,Access会提示你即将删除x行。
大多数时候我想要显示这条消息。我可以使用代码删除指定的行并不提供消息吗?
这是我目前正在使用的代码:
Dim SQLDelete As字符串
SQLDelete ="从EquipID =设备中删除 &安培; Me.List_Device
N / G> < >Thanks for take time to read my question!!
I''m using code that will automatically delete rows of data in a field
and of course when you do this Access will prompt you that you are
about to delete x number of rows.
Most of the time I want this message be displayed. Can I use code
that will delete specified rows and not give the message?
Here is the code that I''m currently using:
Dim SQLDelete As String
SQLDelete = "delete from Equipment where EquipID = " & Me.List_Device
DoCmd.RunSQL SQLDelete
Thanks
N. Graves解决方案You can avoid the message with:
DoCmd.SetWarnings False
However, you won''t know if anything went wrong with the action query. The
following method is better, as it gives a message only if there is a
problem:
dbEngine(0)(0).Execute strSQL, dbFailOnError
If you need an all-or-nothing result for your action query, you can wrap the
whole thing in a transaction. Example in article:
Archive: Move records to another table
at:
http://allenbrowne.com/ser-37.html
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"N. Graves" <ng*****@REMOVEyahoo.com> wrote in message
news:nq********************************@4ax.com...Thanks for take time to read my question!!
I''m using code that will automatically delete rows of data in a field
and of course when you do this Access will prompt you that you are
about to delete x number of rows.
Most of the time I want this message be displayed. Can I use code
that will delete specified rows and not give the message?
Here is the code that I''m currently using:
Dim SQLDelete As String
SQLDelete = "delete from Equipment where EquipID = " & Me.List_Device
DoCmd.RunSQL SQLDelete
Thanks
N. Graves
try wrapping the DoCmd like this
Application.SetOption "Confirm Record Changes", False
Application.SetOption "Confirm Document Deletions", False
Application.SetOption "Confirm Action Queries", False
DoCmd.RunSQL SQLDelete
Application.SetOption "Confirm Record Changes", True
Application.SetOption "Confirm Document Deletions", True
Application.SetOption "Confirm Action Queries", True
i use all three lines to turn everything off when distributing run-times as
i dont want uses to have to fiddle around
you will probably find that you dont need all three lines and just
Application.SetOption "Confirm Action Queries", False
DoCmd.RunSQL SQLDelete
Application.SetOption "Confirm Action Queries", True
will do
hope this helps
Dave
"N. Graves" <ng*****@REMOVEyahoo.com> wrote in message
news:nq********************************@4ax.com...Thanks for take time to read my question!!
I''m using code that will automatically delete rows of data in a field
and of course when you do this Access will prompt you that you are
about to delete x number of rows.
Most of the time I want this message be displayed. Can I use code
that will delete specified rows and not give the message?
Here is the code that I''m currently using:
Dim SQLDelete As String
SQLDelete = "delete from Equipment where EquipID = " & Me.List_Device
DoCmd.RunSQL SQLDelete
Thanks
N. Graves
Hi "N",
Try using the Execute Method (DAO), but be sure to include the dbFailOnError
option.
Like this:
....
Dim MyDB As DAO.Database
Set MyDB = CurrentDB
Dim SQLDelete As String
SQLDelete = "delete from Equipment where EquipID = " & Me.List_Device
MyDB.Execute SQLDelete, dbFailOnError
Set MyDB = Nothing
....
--
HTH,
Don
=============================
Use My*****@Telus.Net for e-mail
Disclaimer:
Professional PartsPerson
Amateur Database Programmer {:o)
I''m an Access97 user, so all posted code
samples are also Access97- based
unless otherwise noted.
Do Until SinksIn = True
File/Save, <slam fingers in desk drawer>
Loop
================================
"N. Graves" <ng*****@REMOVEyahoo.com> wrote in message
news:nq********************************@4ax.com...Thanks for take time to read my question!!
I''m using code that will automatically delete rows of data in a field
and of course when you do this Access will prompt you that you are
about to delete x number of rows.
Most of the time I want this message be displayed. Can I use code
that will delete specified rows and not give the message?
Here is the code that I''m currently using:
Dim SQLDelete As String
SQLDelete = "delete from Equipment where EquipID = " & Me.List_Device
DoCmd.RunSQL SQLDelete
Thanks
N. Graves
这篇关于删除邮件 - 可以选择性地关闭吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!