Hide column programmatically in MS-Access

I want to hide or show a column based on variable data from user selection. How to set a column to hide in MS-Access 2003?

For example,

After changing a custom event ...

For Each ctl In Me.FormNameHere.Form.Controls
    If (TypeName(ctl) = "Textbox") Then
        If InStr(GetTextList(), ctl.Name) > 0 Then
            ctl.hidden = True
        Else
            ctl.hidden = False
        End If
    End If
Next ctl
  • What is the best approach to this problem?
  • Is there a more obvious solution?
+3
source share
4 answers

Controls do not have a “hidden” property (no objects in Access have a hidden property). They have a .Visible property.

, VBE - VBE F2. , . , , .

, Intellisense, / , , , "Me.MyTextBox". Intellisense . ( ), .

, , , ( ).

, , , , . .ColumnHidden .ColumnWidth( , , , , , ).

+5

, . , , , , ?

, . , "" , . , .

+5

, ColumnHidden .

For Each ctl In Me.FormNameHere.Form.Controls
    If (TypeName(ctl) = "Textbox") Then
        If InStr(GetTextList(), ctl.Name) > 0 Then
            ctl.Columnhidden = True
        Else
            ctl.Columnhidden = False
        End If
    End If
Next ctl

.

+3

:

forms(fname).Controls(ctrlname).columnhidden = false

fname - ctrlname -

+2

Source: https://habr.com/ru/post/1722849/


All Articles