如何根据组合框选择隐藏表单中的列? [英] How do you hide columns in form based on combo box selection?

查看:70
本文介绍了如何根据组合框选择隐藏表单中的列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿大家,


我有一个名为Overflow的表单,基于名为Trailers_Unloading_All的查询。在我的主菜单表单上,有一个名为cboDest的组合框。它有两列,DestNumber和DestName,基于一个名为Unl_Seq_Dest的表,其中DestNumber是绑定列。 DestNumber中的值是Overflow表单中的列号(以及Trailers_Unloading_All查询)。进行选择后,用户单击View_Trailers按钮,这将打开Overflow表单。


有没有办法根据组合框中的选择过滤溢出表单,以便它隐藏每一列,但名为Door,Trailer_Number的列和组合中选择的值框?我不确定这是否可行,因为我对VBA没有多少经验。


希望有人能够提供帮助,谢谢!


-Ben

解决方案

< blockquote>


有没有办法根据组合框中的选择过滤溢出表单,以便它隐藏每一列,但名为Door,Trailer_Number的列和选中的值组合框?



通常,在从组合框中选择参数后打开表单时,可以过滤记录以仅显示匹配的那些参数。您通常不会隐藏/显示不同的字段


正如您所说,您不熟悉VB,那么实现最简单的方法(我认为)你要问的是有两个版本的Overflow表单;一个有所有领域,一个有你提到的三个。只需根据需要调用Overflow或Overflow_Short。


S7


谢谢S7,


我猜我的主要问题是我希望组合框过滤表单的列而不是记录(通常是行)。有没有比组合框更好的方法呢?


对于标准表单视图中的表单,可以通过为ComboBox中的每个可能字段创建控件来完成隐藏的。当从ComboBox中选择一个字段时,所有字段都会被隐藏,但是所选控件将变为可见且活动状态。


如果表单在数据表视图中,则此方法不起作用并且需要更改形式'的RecordSource更复杂。


Hey everyone,

I have a form called Overflow based on a query called Trailers_Unloading_All. On my main menu form, there is a combo box called cboDest. It has two columns, DestNumber and DestName, based on a table called Unl_Seq_Dest where DestNumber is the bound column. The values in DestNumber are the column numbers in the Overflow form (as well as the Trailers_Unloading_All query). After making the selection, the user clicks on the View_Trailers button, which will open the Overflow form.

Is there a way to filter the Overflow form based on the selection in the combo box so that it hides every column but the columns called Door, Trailer_Number, and the value selected in the combo box? I''m not sure if this is possible, as I do not have much experience with VBA.

Hopefully someone is able to help, thanks!

-Ben

解决方案

Is there a way to filter the Overflow form based on the selection in the combo box so that it hides every column but the columns called Door, Trailer_Number, and the value selected in the combo box?

Normally, when you open a form after selecting a parameter from a combo-box, you filter the records to display only those that match the parameter. You would not normally Hide/Show different fields.

As you say you are not familiar with VB, then the simplest way to achieve what (I think) you are asking is to have two versions of the Overflow form; one with all the fields and one with just the three you mention. Just call Overflow or Overflow_Short as required.

S7


Thanks S7,

I guess my main issue is that I want the combo box to filter the columns of the form and not the records (usually the rows). Is there a better way to do this than a combo box?


For a form in standard form view, this could be done by creating controls for each possible field from your ComboBox which are all set as hidden. When a field is selected from the ComboBox all are again hidden but then the selected control is made visible and active.

If the form is in datasheet view then this approach wouldn''t work and a more complicated one of changing the form''s RecordSource would be required.


这篇关于如何根据组合框选择隐藏表单中的列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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