重用表格 [英] Reusing a Form

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

问题描述

我想在几个查询前面使用一个表单。对于

示例,我想使用frmA但只查看qryX检索到的记录

。然后我想再次使用frmA,但只查看qryY检索到的记录

。然后可以重复使用frmA来查看来自
qryZ的记录。我的理由是,如果表单发生变化,我不必操作
操纵多个表单。将会有大约20个此类查询。

有没有人做过类似的事情?如果是这样,怎么样?


Don Glenn

I have a form I would like to use in front of several queries. For
example, I want to use frmA but only looking at the records retrieved
by qryX. Then I want to use frmA again, but only looking at the records
retrieved by qryY. Then be able to reuse frmA to view records from
qryZ. My reasoning is that if the form changes, I don''t have to
manipulate multiple forms. There will be approximately 20 such queries.
Has anyone done something similar? If so, how?

Don Glenn

推荐答案



< gl ****** @ cox.net>写了

<gl******@cox.net> wrote
我有一个表格我想在几个查询面前使用
。对于
示例,我想使用frmA但是只查看qryX检索到的记录。然后我想再次使用frmA
,但只查看qryY检索到的记录。然后能够重复使用frmA来查看来自qryZ的记录。我的理由是,如果表格改变,我不必操纵多种形式。将会有大约20个这样的问题。
I have a form I would like to use
in front of several queries. For
example, I want to use frmA but
only looking at the records retrieved
by qryX. Then I want to use frmA
again, but only looking at the records
retrieved by qryY. Then be able to
reuse frmA to view records from
qryZ. My reasoning is that if the form
changes, I don''t have to manipulate
multiple forms. There will be approxi-
mately 20 such queries.




有三种方法可以立即想到......关于猜测你的表格

提到绑定查询,并且你用VBA打开它并带有

DoCmd.OpenForm语句。


似乎查询之间的唯一区别是返回的记录是什么
,而不是一组不同的字段(也许可以用一个表单来处理

,但不会这很容易)。


DoCmd.OpenForm有两个参数,你可以在其中提供条件来限制表格'RecordCoource中的记录
:FilterName和

WhereCondition。在至少某些版本的Access中,您可以在Filter或Where

Condition参数中传递包含完整SQL语句的字符串的名称

,如果你的话相当。您可以使用其中一个,或者,或者更高效地使用
,使用OpenArgs参数传递确切的SQL

,用于替换Form的RecordSource in Form'的公开活动。


Larry Linson

Microsoft Access MVP



Three ways come immediately to mind... on the guess that the Form you
mention is bound to the Query, and that you are opening it from VBA with a
DoCmd.OpenForm statement.

It seems that the only difference between the Queries is which Records are
returned, not a different set of Fields (which could, perhaps, be handled
with a single Form, but wouldn''t be as easy).

The DoCmd.OpenForm has two arguments in which you can supply criteria to
limit the Records from the Form''s RecordSource: FilterName and
WhereCondition. In at least some versions of Access, you can pass the name
of a string containing a complete SQL statement in the Filter or Where
Condition arguments, if you''d rather. You could use one of those, or,
perhaps more efficiently, use the OpenArgs argument to pass the exact SQL
which you use to replace the Form''s RecordSource in the Form''s Open event.

Larry Linson
Microsoft Access MVP


使用表单的Recordsource属性。如果您将其设置为

另一个记录集,瞧。


只有字段名称相同时才会显示数据。

gl******@cox.net 写道:
By using the Recordsource property of the form. If you set that to
another recordset, voila.

Data will show only if the fields have the same names.

gl******@cox.net wrote:
我有一个表单我想在几个查询前面使用。对于
示例,我想使用frmA但只查看qryX检索到的记录。然后我想再次使用frmA,但只查看qryY检索到的记录。然后能够重用frmA来查看来自qryZ的记录。我的理由是,如果形式发生变化,我不必操纵多种形式。将会有大约20个此类查询。
有没有人做过类似的事情?如果是这样,怎么样?

Don Glenn
I have a form I would like to use in front of several queries. For
example, I want to use frmA but only looking at the records retrieved
by qryX. Then I want to use frmA again, but only looking at the records
retrieved by qryY. Then be able to reuse frmA to view records from
qryZ. My reasoning is that if the form changes, I don''t have to
manipulate multiple forms. There will be approximately 20 such queries.
Has anyone done something similar? If so, how?

Don Glenn




-

Bas Cost Budde,Holland
http://www.heuveltop.nl/BasCB/msac_index.html



--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html


" Larry Linson" <博***** @ localhost.not>写在

news:nUFue.2579
"Larry Linson" <bo*****@localhost.not> wrote in
news:nUFue.2579


这篇关于重用表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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