MS Access交叉表查询参数 [英] MS Access Crosstab Query parameters

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

问题描述

是否可以像选择查询一样在查询中引用表单的组合框/文本框?

Is there a way to reference a form's combo/text box within the query like a select query?

我通常在选择查询的条件中使用以下类似内容:

I usually use something like this in a select query's criteria:

like forms!frmMain.qTitleofSomething&*   (access adds the brackets for me)

但这在交叉表查询中不起作用???我刚发现的有没有一种方法可以在不设置多个交叉表的情况下完成相同类型的参数控制?

but this does not work in a crosstab query?? which I just found out. is there a way to accomplish the same kind of parameter control without setting up multiple crosstabs?

推荐答案

如果要引用表单,则需要在查询中添加参数.可以通过在查询设计窗口中右键单击或键入它来执行此操作.进入SQL视图.您应该最终得到以下内容:

You need to add a parameter to the query if you wish to reference a form You can do this by right-clicking in the query design window or by typing it into the SQL view. You should end up with something on the lines of:

PARAMETERS [Forms]![frmA]![Field1] Short;
TRANSFORM Count(tblA.ID) AS CountOfID
SELECT tblA.Field2, Count(tblA.ID) AS [Total Of ID]
FROM tblA
WHERE tblA.Field1=[Forms]![frmA]![Field1]
GROUP BY tblA.Field2
PIVOT tblA.Field1;

Short 是指字段的数据类型.这些类型包含在一个下拉列表中,可以通过右键单击查询设计窗口并选择参数"来实现.

Short refers to the data type of the field. The types are included in a drop down list available from right-clicking in the query design window and selecting Parameters.

这篇关于MS Access交叉表查询参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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