Forum Discussion
ColumnHidden Property - Doesnt seem to hide
That should be effective, but we probably don't have enough information to be clear about what else might be going on.
I use this code to hide columns I want to remain hidden and to set other columns to fit the exact width of the visible text in those columns. I run it from the Current event of the form. It has the same syntax you mentioned.
==========
For Each ctl In frm.Controls
If ctl.Tag = "Hidden" Then
If ctl.ColumnHidden = False Then ctl.ColumnHidden = True
ElseIf ctl.Tag = "Fixed" Then
ctl.ColumnWidth = -2 ' -2 sets column width to fit displayed text exactly
Else
'Future use?
End If
Next ctl
frm.RowHeight = 0.1667 * 1440 ' set rows to default height
===========
Can you isolate the times when it is effective as opposed to when it isn't? It's true that events can interact in a dynamic process.
Hi George,
thank you for the response. I seem to get a Object Required when the form opens (please see pic below). I would like to test to see if it is what I need.
thank you. Happy New Year!
- George_HepworthJan 01, 2022Silver ContributorSorry I didn't intend for that to be used as is. I posted it as an example of a procedure I use that works with the ColumnHidden property the same way you did.
I should have included the entire Sub. I'll do that. However, if it isn't working in your code, it may not be effective either.