禁用MS Access表单的“详细信息"部分中的所有控件 [英] Disable all controls in 'details' section of a MS Access form

查看:107
本文介绍了禁用MS Access表单的“详细信息"部分中的所有控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一些命令,该命令将禁用MS Access Form的详细信息"部分中存在的所有控件.一种方法是独立禁用每个控件.我正在寻找一种独立于控件的方法,该方法将禁用MS Access Form详细信息部分中存在的所有控件.

I am looking for some command which will disable all controls present in the 'details' section of an MS Access Form. One way is to disable each and every control independently. I am looking for a control-independent way which would disable all the controls present in the details section of MS Access Form.

如果要基于某些登录凭据启用表单,并且用于输入凭据的字段位于表单的标题部分,则此功能可能很有用.因此,一旦用户登录,该表格中的所有控件都会启用. Uplon注销,应将其禁用.

This feature might be useful, if the form is to be enabled based on some login credentials and the fields for entering credentials is placed in the header section of the form. So, as soon as user does login, all the controls in that form are enabled. Uplon logout, they shall be disabled.

我尝试搜索它,但似乎不支持该搜索.或者以前没有人有这样的要求.

I tried searching for it but it seems the same is not supported. Or no one had such a requirement before.

如果有人知道,请帮助我.

Please help me if anyone knows.

推荐答案

表单具有符合此要求的各种属性:允许编辑,允许添加和允许删除.允许编辑适用于未绑定的控件,甚至适用于未绑定的表单.

A form has various properties that match this requirement: Allow Edits, Allow Additions and Allow Deletions. Allow Edits works for unbound controls, it even works on unbound forms.

如果需要禁用某些控件,可以将这些控件的tab属性设置为字符串,然后遍历表单的控件集合以禁用这些控件.

If you have a requirement to disable certain controls, you can set the tab property for these controls to a string and then iterate through the form's control collection to disable those controls.

Dim frm As Form
Dim ctl As Control

Set frm = Forms!MyOpenForm

For Each ctl In frm.Controls

    If ctl.ControlType <> acLabel And ctl.ControlType <> acTabCtl Then
        If ctl.Tag = "AdminHide" Then
            If varWho = "Authorized" Then
                ctl.Visible = True
            Else
                ctl.Visible = False
            End If
        End If

    End If

Next

这篇关于禁用MS Access表单的“详细信息"部分中的所有控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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