如何使用查询控制哪些列显示为输出? [英] How to control which colums are displayed as output by using query?

查看:63
本文介绍了如何使用查询控制哪些列显示为输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题比我想的要复杂一点。我想要完成的任务我将用一个例子来解释:


我有一个基于查询的子表单。此查询是包含5列的数据表。我有一个文本框,我输入数据,点击命令按钮,它搜索查询并显示子窗体中的匹配项。但是,它显示了所有5列...我理想的做法是有一个对应于每列的复选框,并且在选中时,该列显示在结果中。因此,如果我选择了checkbox1和checkbox2,则column1和column2是在子窗体中显示为结果的唯一列。


如果有人知道如何将其拉出来那将是非常棒的。另外,如果问题不清楚,请告诉我 - 可能很难概念化。


谢谢:)

The question is a bit more complicated than it sounds I think. What I am trying to accomplish I will explain using an example:

I have a subform based on a query. This query is a data table that contains 5 columns. I have a textbox into which I input data, hit a command button, and it searches the query and displays matching items in the subform. However, it shows all 5 columns... What I would ideally like to do is have a checkbox that correspnds to each column and, when checked, that column is displayed in the results. So, if I have checkbox1 and checkbox2 selected, column1 and column2 are the only columns displayed as results in the subform.

If anyone knows how to pull this off that would be awesome. Additionally, if the question is unclear just let me know - it might be hard to conceptualize.

Thanks :)

推荐答案

是否也打算将搜索范围限制在所选的那些字段上?


就限制显示而言,所有字段都必须存在绑定控件。但是,完全可以根据CheckBoxes的值隐藏您选择的控件。这听起来像你追求的那样吗?


解释你为什么需要这个,可能有助于概念化。
Is the intention also to limit the searching to just those fields selected too?

As far as limiting the display is concerned the bound controls must be there for all fields. However, it is perfectly possible to hide the controls of your choice depending on the values of the CheckBoxes. Does this sound like what you''re after?

An explanation for why you need this, may help conceptualisation.


@NeoPa


我需要这个,因为我想要搜索的一些表包含20多列,其中大多数都是无关紧要的。我希望用户能够选择他们想要显示的列,这样他们就可以查看更多相关信息,而不是滚动浏览所有内容。


我对如何隐藏感兴趣基于复选框的控件。这是否意味着我可以隐藏哪些列出现?


再次感谢
@NeoPa
I need this because some tables I want to search through contain 20+ columns, most of which are irrelevant. I want the user to be able to select which columns they want to appear so they may be able to view more relevant information instead of scrolling through everything.

I am interested in how to hide the controls based on checkboxes. Does this mean I will be able to hide what columns appear?

Thanks again


隐藏是。那是相对简单的。每个控件都有 .Visible 属性。更有趣的是你想​​要做的差距。显然,表单或报表的设计主要是手动完成的,但如果您觉得值得付出努力,也可以使用代码调整控件的大小和重新定位控件。
Hiding yes. That''s relatively straightforward. Every control has a .Visible property. What is more intriguing is what you want done with the gaps. Obviously the design of the form or report is mainly done manually, but you can resize and reposition controls with your code too if you feel that would be worth the effort.


这篇关于如何使用查询控制哪些列显示为输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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