在循环到requery之前无法获取要关闭的查询 [英] Can't get query to close before looping to requery

查看:49
本文介绍了在循环到requery之前无法获取要关闭的查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我正在使用从表单(包括Payroll Contact)获取输入的函数,将其用作查询参数,运行查询,然后发送电子邮件使用sendObject方法的自定义.xls文件到列表中指定的工资单联系人。


完成此功能后,它会循环到列表中的下一个[PayrollContact]人员并重新查询以向他们发送自定义列表。

问题:发送第一个列表后,第一个查询将不会关闭,导致相同的列表被发送到各个电子邮件中的每个PayrollContacts。


如果我可以获得查询在我移动到下一个记录之后关闭并重新打开它应该用正确的数据刷新自己。


关于我的代码有什么问题的任何想法?所有帮助都非常值得赞赏。 (我在XP上使用Access 2003)

Hi there,
I''m woking on a function that takes the input from a form (including Payroll Contact), uses it as a query parameter, runs the query, and then emaills out a custom .xls file using the sendObject method to the Payroll Contact specified in a list.

After perfroming this function it loops to the next [PayrollContact]person on the list and requeries to send them a custom list.

The problem: After sending the first list the first query will not close causing the same list to be sent to each of the PayrollContacts in individual emails.

If I can get the query to close and reopen after I''ve moved to the next record it should refresh itself with the correct data.

Any ideas on what''s wrong with my code? All help is greatly apprecated. (I''m using Access 2003 on XP)

展开 | 选择 | Wrap | 行号

推荐答案

而不是DoCmd查询操作我会使用模板。查询例如命名为qryLocationCutTemplate,如:

select * from tblX,其中WorkLocation =''
Instead of the DoCmd query manipulation I would use a "template" query e.g. named qryLocationCutTemplate like:
select * from tblX where WorkLocation = ''


WorkLocation
WorkLocation


'')

在我将使用的代码中:
'')
In the code I would use:
展开 | 选择 | Wrap | 行号


这篇关于在循环到requery之前无法获取要关闭的查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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