1

I have hidden several columns in an access datasheet using the ColumnHidden property like this example here:

ColumnName.ColumnHidden = true

This works great, but when I view the datasheet, the end user can unhide the column by "resizing" the space either side of where the column is hiding:

enter image description here

I have found a couple of hacks to resize the columns using the ColumnWidth property via vba on certain events vba etc. but I was wondering whether there is a simple way to disable this "resize" feature in the first place for hidden columns only?

braX
  • 11,506
  • 5
  • 20
  • 33
Joe
  • 616
  • 2
  • 12
  • 27

1 Answers1

3

In MouseUp event You can check if ColumnHidden of hidden column is false (user "resized" the column), hide it.

Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Me.MyHiddenColumn.ColumnHidden = False Then
    Me.MyHiddenColumn.ColumnHidden = True
End If
End Sub
Sergey S.
  • 6,296
  • 1
  • 14
  • 29
  • Yes - I never thought of that. That is simple and effective too. Excellent. Thank you. – Joe Jan 31 '18 at 13:36