发送密钥问题 [英] Send key issue

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

问题描述

我想在运行make table查询时编写代码来在VBA中执行sendkeys。目前我通过宏来做到这一点,但充其量只是问题。当我打开我的数据库时,我在表单的onOpen中运行此宏。该宏具有发送密钥。 y表示y。然后运行make table查询。在某些用户的'Pcs上,它仍然会问这个问题,有时会出现位置问题的错误(宏本身的​​位置)。我把错误处理放在那个特定的错误代码中,但它被击中并且错过了。我有几个我需要这样做的数据库,所以我正在寻找指导来取消宏并让VBA启动make表但是要回答所有可以访问的pop框以覆盖表。

I want to write code to do sendkeys in VBA for when I run a make table query. Currently I do this through a macro, but its problematic at best. When I open my database I have in the onOpen of the form to run this macro. The macro has a "send key" of "y" then to run the make table query. On some users'' Pcs it still asks the question, sometimes it pops up an error for a location problem (Location of the Macro itself). I put error handling in for that specific error code, but it to was hit and miss. I have a couple of Databases I need to do this to, so I''m looking for guidance to do away with the macro and have VBA launch the make table but to answer all of the pop boxes that access kicks out for overwriting a table.

展开 | 选择 | Wrap | 行号

推荐答案

如果您想要停止Access放置警告消息在运行Insert,Update时,我会假设创建查询,然后你只需要使用 DoCmd.SetWarnings = False 命令。打开查询后,我总是建议将其设置为True,以便为意外点击提供保护。
If you are wanting to stop the warning message that Access puts up when running Insert, Update, and I would assume Create queries as well, then you just need to use the DoCmd.SetWarnings = False command. I would always recommend setting it back to True after you have opened your query so that you have that protection for the accidental click.


Seth的好建议。


一些更好的建议是很少(如果有的话)在共享的数据库中使用SendKeys。如果你用它来玩自动化的东西,那就是一件事,但大多数人想在DB在后台工作的时候使用他们的PC ....
Good advice from Seth.

Some more good advice is to very rarely (if ever) use SendKeys in a DB that is shared. If you are using it to play around an automate things, that is one things, but most folks want to use their PC while the DB is working in the background....


忘了 DoCmd.OpenQuery()并忘记 DoCmd.SetWarnings(False)并使用 Database.Execute( )


你想继续使用宏,所以继续从基于宏的 DoCmd 也是。尽可能使用对象方法。
Forget DoCmd.OpenQuery() and forget DoCmd.SetWarnings(False) and use Database.Execute().

You''re wanting to move on from using macros, so move on from Macro-based DoCmd too. Use object methods where possible.


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

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