在Microsoft Access 2007数据表使用VBA隐藏列 [英] Hiding columns in a Microsoft Access 2007 datasheet with VBA

查看:142
本文介绍了在Microsoft Access 2007数据表使用VBA隐藏列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想隐藏特定的列通过code的Access 2007年分裂的形式。我需要的形式,以检查特定的条件,看它是否需要显示一列或没有。我有code形式的激活事件隐藏这样的列:

I am trying to hide specific columns in an Access 2007 split form through code. I need the form to check certain conditions to see whether it needs to display a column or not. I have code in the form's 'Activate' event to hide the column like this:

txtControl.ColumnHidden = True

这code工作在打开的事件,但如果我隐藏激活列,它不会显示这些变化,直到我关闭窗体,然后再次打开它。我已经打过电话形式的刷新,重画,并重新查询方法,但是这并不工作。请帮帮忙!

This code works in the "Open" event, but if I hide the column on Activate, it won't display these changes until I close the form and open it again. I have tried calling the form's refresh, repaint, and requery methods, but this doesn't work. Please help!

编辑:理想情况下,我需要这个事件发生时的焦点切换到该form.That就是为什么我使用Activate事件,而不是打开事件

Ideally, I need this event to occur whenever the focus switches to this form.That's why I'm using the Activate event rather than the Open event.

推荐答案

尝试无论是在形式的的当前或的加载事件您也可能需要设置该属性后重新查询控制: Me.TextControl.Requery 目前被称为每次一个窗体的记录发生改变时,窗体被粉刷或重新查询。装载,顾名思义,被调用一次,以后的形式已打开时的形式加载它的记录。这些一向是比较可靠的,我比使用激活,这确实需要做更多形式的重点,而不是你真正想要的东西。

Try setting it in either the form's Current or Load events. You will also probably need to requery the control after setting that property: Me.TextControl.Requery Current is called every time a form's record is changed, the form is repainted or requeried. Load, as its name suggests, is called once, after the form has opened when the form loads its records. These have always been more reliable for me than using Activate, which really has to do with more the focus of the form, not really what you want.

这篇关于在Microsoft Access 2007数据表使用VBA隐藏列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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