如何在后台运行宏 [英] How to run a macro in the background

查看:175
本文介绍了如何在后台运行宏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对VBA一无所知,所以请把一切都搞清楚。


我已经设置了一个运行2个查询的宏,一个用于将记录移动到另一个表,另一个从原始表中删除记录。有没有办法将其设置为在后台自动运行?


另外,我有一个查询,我想每次有人添加新内容并将其通过电子邮件发送到我。有没有办法做到这一点??同样在后台?

I know absolutely nothing about VBA so please make everything somewhat simple.

I''ve set up a macro that runs 2 queries, one to move a record to another table, the other to delete the record from the original table. Is there a way to set this to automatically run, in the background?

Also, I have a query that I would like to run everytime someone adds something new and to have it emailed to me. Is there a way to do that?? Also in the background?

推荐答案

自动运行通常意味着某种触发器。是日期/时间相关还是其他一些行动的结果。没有基本的触发器就很难回答你的第一个问题。


至于第二个问题,如果你能清楚地理解你的意思,那么会增加新的东西的"那我们可以帮忙。这应该是可能的。


作为一般规则,所有代码都在后台运行,因为你只能看到它显示的内容。否则,操作员需要在进程运行之前等待,然后继续。
Running automatically generally implies some sort of trigger. Whether it be date/time related or a result of some other action. Without the basic trigger it is hard to answer your first question.

As for the second, if you can give a clear understanding of what you mean by "adds something new" then we can probably help. This should be possible.

As a general rule, all code runs in the background in as much as you only get to see what it shows. Otherwise, the operator will need to wait while the process runs before continuing.


@NeoPa


NeoPa,


当人退出时触发器可以吗?或者即使数据库没有打开也可能是一段时间?


添加新内容我将解释数据库的用途,希望这会有所帮助。


我们使用数据库来跟踪报价请求,销售代表输入所有信息,现在告诉我们我,他们已经添加了一些新东西,所以我知道进入并获取信息,以便我可以在另一个程序中构建报价。我希望有一种方法可以在他们提出请求后(一个或多个)向我发送一封电子邮件,这样代表就不必浪费时间通过电子邮件向我发送关于它自动完成的请求的电子邮件。我已经完成了一个只提取新请求的查询,我找到了一个将运行查询并将其发送给我的宏,但是有一个弹出屏幕,询问我是否要发送电子邮件而我我想设置一下没有弹出窗口。到目前为止,我还没有在VBA中做过任何事情,我只使用了查询和宏。我在网上找到了一些信息但是我不知道输入什么来开始或结束....命令,我想。我对VBA一无所知,但我愿意学习。


谢谢。
@NeoPa
NeoPa,

Can the trigger be when the person exits?? Or can it be a certain time even if the database isn''t open??

The "adds something new" I''ll explain what the database is used for and hopefully that will help.

We use the database to track quote requests, the sales rep puts in all the info and right now tells me that they have added something new so I know to go in and get the info so I can build the quote in another program. I was hoping there was a way for an email to be sent to me after they put in the request (one or more) so the rep doesn''t have to waste time emailing me about the request it''s just automatically done. I''ve done a query that just pulls the new requests and I''ve found a macro that will run the query and send it to me but there is a pop-up screen that asks if I want to send the email and I''d like to have it set up that there is no pop-up. So far I haven''t done anything in VBA, I''ve only used queries and macros. I have found some info online but I have no clue what to type to start or end the.... command, I guess. I know nothing about VBA, but I''m willing to learn.

Thanks.


它有很多可能的触发器''几乎不可能列出所有这些。任何事件都可以是触发器。每个对象都有各种事件,并且对象的数量仍在增长。关闭数据库对象肯定是一个可以处理的事件,对于那个是肯定的。


就电子邮件而言,存在与安全性相关的问题。我相信有各种各样的主题讨论这些主题,但我发现我没有任何关于它们的说明。它肯定很复杂,特别是对于那些刚接触它的人。


当然,当表单关闭时很容易触发代码(这可能与它们完成时的情况一致)输入报价。


我应该说清楚,尽管我们很乐意尽可能多地提供帮助,但我们并没有真正能够推动整个项目为了你。这绝不意味着我们不准备提供帮助,但对于像这样大的任务,我们需要你做大部分的工作。我讨厌推迟那些愿意学习的人,但对于那些对VBA 一无所知的人来说,这似乎是一项非常复杂的工作。
There are so many possible triggers that it''s almost impossible to list them all. Any event can be a trigger. There are various events for each object, and the number of objects there are is still growing. Closing the database object is certainly an event that can be handled though, so yes to that one.

As far as email goes, there are problems there that are related to security. I believe there are various threads which discuss these topics, but I find I have no notes on any of them to hand. It''s certainly complicated, especially for someone new to it all.

Certainly though, code can easily be triggered when a form is closed (which would probably coincide with when they had completed entering the quotes).

I should make it clear that, though we are happy to help as much as is practicable, we''re not really in a position to drive a whole project for you. That doesn''t by any means imply we''re not prepared to help, but for a task as large as this, we would need you to be doing the bulk of the work. I hate to put off anyone who''s willing to learn, but this does seem a pretty complicated undertaking for someone who knows nothing about VBA.


这篇关于如何在后台运行宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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