解决方案 您可以通过以下方式避免消息: 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 fieldand of course when you do this Access will prompt you that you areabout to delete x number of rows.Most of the time I want this message be displayed. Can I use codethat will delete specified rows and not give the message?Here is the code that I''m currently using:Dim SQLDelete As StringSQLDelete = "delete from Equipment where EquipID = " & Me.List_DeviceDoCmd.RunSQL SQLDeleteThanksN. Graves 解决方案 You can avoid the message with:DoCmd.SetWarnings FalseHowever, you won''t know if anything went wrong with the action query. Thefollowing method is better, as it gives a message only if there is aproblem:dbEngine(0)(0).Execute strSQL, dbFailOnErrorIf you need an all-or-nothing result for your action query, you can wrap thewhole thing in a transaction. Example in article:Archive: Move records to another tableat: http://allenbrowne.com/ser-37.html--Allen Browne - Microsoft MVP. Perth, Western Australia.Tips for Access users - http://allenbrowne.com/tips.htmlReply to group, rather than allenbrowne at mvps dot org."N. Graves" <ng*****@REMOVEyahoo.com> wrote in messagenews: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. Gravestry wrapping the DoCmd like thisApplication.SetOption "Confirm Record Changes", FalseApplication.SetOption "Confirm Document Deletions", FalseApplication.SetOption "Confirm Action Queries", FalseDoCmd.RunSQL SQLDeleteApplication.SetOption "Confirm Record Changes", TrueApplication.SetOption "Confirm Document Deletions", TrueApplication.SetOption "Confirm Action Queries", Truei use all three lines to turn everything off when distributing run-times asi dont want uses to have to fiddle aroundyou will probably find that you dont need all three lines and justApplication.SetOption "Confirm Action Queries", FalseDoCmd.RunSQL SQLDeleteApplication.SetOption "Confirm Action Queries", Truewill dohope this helpsDave"N. Graves" <ng*****@REMOVEyahoo.com> wrote in messagenews: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. GravesHi "N",Try using the Execute Method (DAO), but be sure to include the dbFailOnErroroption.Like this:....Dim MyDB As DAO.DatabaseSet MyDB = CurrentDBDim SQLDelete As StringSQLDelete = "delete from Equipment where EquipID = " & Me.List_DeviceMyDB.Execute SQLDelete, dbFailOnErrorSet MyDB = Nothing....--HTH,Don=============================Use My*****@Telus.Net for e-mailDisclaimer:Professional PartsPersonAmateur Database Programmer {:o)I''m an Access97 user, so all posted codesamples are also Access97- basedunless otherwise noted.Do Until SinksIn = TrueFile/Save, <slam fingers in desk drawer>Loop================================"N. Graves" <ng*****@REMOVEyahoo.com> wrote in messagenews: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 这篇关于删除邮件 - 可以选择性地关闭吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-26 07:34