何时运行保存的查询? [英] When is a Saved Query run?

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

问题描述

我有表格包含世界上的鸟类名称。

tGN - 科学(拉丁语)属名

I have tables to contain the names of the birds of the world.
tGN - Genus scientific (Latin) names

展开 | 选择 | Wrap | 行号

推荐答案

您可以创建一个Temporary QueryDef对象。如果要重复使用动态SQL语句而不必在QueryDefs集合中创建任何新的永久对象,则临时QueryDef对象非常有用。我将在下面发布一些示例代码:
You could create a Temporary QueryDef Object. Temporary QueryDef Objects are useful if you want to repeatedly use Dynamic SQL statements without having to create any new permanent objects in the QueryDefs collection. I''ll post some sample code below:
展开 | 选择 | Wrap | 行号


感谢您的回复。但我现在比以前更不确定。


1)我正在努力减少时间(提高执行速度)。这有什么用?


2)每次我想要执行DLookup或DCount时,似乎我都必须运行查询。这就是我想要避免的。如果这是在Form.Load事件中,并且qdfTemp是全局的,那么查询是否会在整个执行过程中持续存在?如果我的任何一个表发生了变化,它会更新吗?


3)为什么声明#16?如果qdfTemp是一个局部变量,它将在过程结束时消失,这将确保必须为每个DCount运行查询。如果它是全局的,它会在项目结束时消失。


4)这个临时对象在DCount中是如何引用的?
Thanks for the reply. But I''m more unsure now than I was.

1) I''m trying to decrease time (increase execution speed). How does this help?

2) It appears as if I would have to run the query each time I wanted to do a DLookup or DCount. This is what I am trying to avoid. If this were in the Form.Load event, and qdfTemp were global, would the query persist through the entire execution? Would it update if either of my tables changed?

3) Why statement #16? If qdfTemp is a local variable, it goes away when the procedure ends, and this would assure that the query must be run for each DCount. If it is global, it would go away when the project closed.

4) How is this temporary object refered to in DCount?
展开 | 选择 | Wrap | 行号


我正在考虑根据DCount()/ DLookup()中定义的Criteria创建Temporary QueryDef对象。函数,然后在结果集上检索Recordset Count作为伪域函数的排序。我很可能不在这个基础上,所以忘掉我刚说的一切(LOL)。
I was thinking more along the lines of creating a Temporary QueryDef Object based on the Criteria defined in the DCount()/DLookup() Functions, then retrieving a Recordset Count on the Result Set as sort of a Pseudo Domain Function. I''m probably way off base on this one, so forget everything I just said (LOL).


这篇关于何时运行保存的查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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