Forum Discussion
ColumnHidden Property - Doesnt seem to hide
Here's a full Function.
Public Function DataSheetControls(ByRef frm As Form) As Variant
'---------------------------------------------------------------------------------------
' Procedure : DataSheetControls
' Author : GPC Data
' Date : 9/25/2010
' Purpose :
'---------------------------------------------------------------------------------------
On Error GoTo errHandler
Dim ctl AS Control
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
End If
Next ctl
frm.RowHeight = 0.1667 * 1440 ' set rows to default height
exitProc:
Exit Function
errHandler:
MsgBox Err & " " & Err.Description
Resume Cleanup
End Function
Call it like this:
Private Sub Form_Current()
Call DataSheetControls(Me)
End Sub
Hi George,
thank you. I seem to get a 'label not defined" msg box on RESUME CLEANUP.
I put the code in my module and calling from the current event on the form as detailed above.
Let me know if I am not following.
thanks!