Access 2007查询工作manualy但使用宏时没有完成 [英] Access 2007 query works manualy but does not finish when using macro

查看:67
本文介绍了Access 2007查询工作manualy但使用宏时没有完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一组查询,使用多个条件的公式和引用表来更新表。当我手动运行查询时,最终表会显示预期值,但是当我尝试使用Macro自动执行时,某些查询会执行
无法正确更新。 



解决方案

我不使用宏,所以我不确定是否稍后会这样做在稍后的宏操作开始运行之前,宏操作实际上等待先前的宏操作完成(包括数据更新)。 


然而,这听起来我连续更新查询的数据更新是异步执行的,并且您的整个过程遇到了后续更新查询的时间问题(使用时)由早期更新查询更新的值)在之前的更新查询完成更新过程之前,启动
。 在这种情况下,稍后的更新查询将使用"旧"更新查询。这些值最终会导致不正确的更新。


如果您通过GUI运行更新查询序列,则不会发生这种情况,因为您启动的GUI步骤将会很多慢于宏操作序列。


使用一系列VBA语句执行一系列更新查询可能会出现同样的问题。 我知道如何确保在下次更新开始之前完全提交早期更新,但不幸的是,我不知道如何使用宏操作来解决这个问题。


也许,具有更多Macro经验的人可以稍后使用Macro解决方案进入。  


您对VBA有任何经验吗?



I have a set of queries that update a table using both formulas and reference tables for multiple conditions. When I run the queries manualy the final table comes out with the expected values, but when I try to automate using Macro, some queries do not update properly. 

解决方案

I don't use Macros so I am not sure whether a later Macro Action actually waits for the previous Macro Action to complete (including the data updates) before the later Macro Action begins to run. 

However, this sounds to me that the data updates by successive Update Queries are being executed asynchronously and your whole process encounters the timing issue where a later Update Query (that uses values updated by an earlier Update Query) starts before the earlier Update Query has finished its updating process.  In this case, the later Update Query will use the "old" values and you end up with incorrect updates in the end.

This does not happen if you run the sequence of Update Queries through the GUI since the GUI steps initiated by you will be a lot slower than the sequence of Macro Actions.

The same problem can occur using a sequence of VBA statements to execute a sequence of Update Queries.  I know how to ensure that an earlier update is completely committed before the next update is initiated but unfortunately, I don't know how to this using Macro Actions.

Perhaps, someone with more Macro experience can jump in later with Macro solution.  

Do you have any experience with VBA?


这篇关于Access 2007查询工作manualy但使用宏时没有完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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