如何将控制按钮链接到组合框过滤器? [英] How do i link a control button to a combo box filter?

查看:46
本文介绍了如何将控制按钮链接到组合框过滤器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何根据组合框中选择的信息链接控制按钮以查看报告?


例如

我想要显示名为Steve的人的所有记录。

我可以从组合框中选择Steve,然后我希望能够按下预览按钮查看名为Steve的所有记录的过滤报告。 br />

我不喜欢使用VBA,所以如果有人能解释使用宏构建器会很棒!

How can i link a control button to view a report based on the information selected in a combo box?

For example
I want to show all records for people with the name Steve.
I can select Steve from the combo box then i want to be able to press a preview button to view the filtered report for all records with the name Steve.

I dont like to use VBA so if anyone can explain using the macro builder that would be great!

推荐答案




如果你想在没有VBA的情况下这样做,请按照以下步骤操作:


1)命名你的组合框例如。 " cboName"

2)在设计视图中进行查询,从表格中选择您想要的字段并输入名称

3)在名称标准字段中,写入 ; [表单]![YourFormName]。[cboName]"

4)根据您刚刚提出的查询向导报告

5)在表格上,按一下按钮,然后在向导中选择Report Operations - >预览报告并选择您刚刚制作的报告。

6)给按钮一个合适的名称,例如。 cmdPreview


这应该做你想做的事情,


NDayave
Hi,

If you want to do this without VBA, follow these steps:

1) Name your combo box Eg. "cboName"
2) Make a query in design view selecting the fields you want from the table with the names stored
3) In the Name Criteria field, write "[Forms]![YourFormName].[cboName]"
4) Make a report with the Wizard based on the Query you just made
5) On the form, make a button and in the wizard select Report Operations -> Preview Report and select the report that you have just made.
6) Give the button a suitable name as well Eg. "cmdPreview"

That should do what you want to do,

NDayave


对不起我是新来的!


第3点 - 在名称标准字段中,写下[Forms]![YourFormName]。[cboName]"


哪个部分与此相关?组合框/查询?


感谢您的帮助!
Sorry i''m new to this!

Point 3 - In the Name Criteria field, write "[Forms]![YourFormName].[cboName]"

which section does this relate to? The combo box/ query?

Thank you for your help so far!


查询后,在设计视图中打开它。如果你选择了你的姓名字段,应该看起来像


字段:姓名

表:YourTableName

排序:

显示:已勾选
标准:<这是您放置[表格]的地方![YourFormName]。[cboName]>


您需要将YourFormName替换为组合框所在表单的名称,并使用cboName替换组合框的名称。



如果你想测试它是否正常工作,打开表单,在你的组合框中选择一些东西,然后运行查询,看看结果是否与你在组合框中所做的选择相匹配。
When you have made your query, open it in design view. Where you have your Name field selected, should look something like

Field: Name
Table: YourTableName
Sort:
Show: Ticked
Criteria: <This is where you put [Forms]![YourFormName].[cboName]>

You need to substitute YourFormName for the name of the form that the combo box is on, and cboName for the name of the combo box.


What this does, is when your form is open and there is a selection in the combo box, it will take the selection and enter it into the query, only selecting the records from the table that match it.
If you want to test if it is working, open the form, select something in your combo box, then run the query and see if the results match the selection you have made in the combo box.


这篇关于如何将控制按钮链接到组合框过滤器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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