Forum Discussion
Tony2021
Dec 31, 2021Steel Contributor
ColumnHidden Property - Doesnt seem to hide
Hello, is the below the correct code to turn on/off the columnhidden in a datasheet? Me.txtProjName2.ColumnHidden = True Me.txtProjName2.ColumnHidden = False I have opened the form and rig...
George_Hepworth
Silver Contributor
Tony2021 It should impact only controls with one of the two tags specified. (The tag has to match exactly.)
By the way, I also seem to have misinterpreted the original question. You specified a datasheet in the original question.
However, in this answer you mention a split form, in which there is both a datasheet section and a "normal" section. I must have missed that before.
I am not sure that I've ever tried something like this in a split form. I'm sure it would not impact the normal view section of the form, even if it does work with the datasheet section.... More testing required.
Tony2021
Jan 01, 2022Steel Contributor
George, I have found the answer. The previously posted codes do not work on a split form. Only the below works for a split form. I searched quite a bit online. Many websites do not state that a split form requires different codes. Anyways, I am using the below and it works great. thank you for the assistance. I can use the other codes on another form to auto fit the fields.
Private Sub txthide_Click()
'Me.txtProjectName.ColumnHidden = True 'this doesnt work on a split form
Screen.ActiveDatasheet.txtProjectName.ColumnHidden = True
End Sub
Private Sub txtUnhide_Click()
'Me.txtProjectName.ColumnHidden = False 'this doesnt work on a split form
Screen.ActiveDatasheet.txtProjectName.ColumnHidden = False
End Sub
Private Sub txthide_Click()
'Me.txtProjectName.ColumnHidden = True 'this doesnt work on a split form
Screen.ActiveDatasheet.txtProjectName.ColumnHidden = True
End Sub
Private Sub txtUnhide_Click()
'Me.txtProjectName.ColumnHidden = False 'this doesnt work on a split form
Screen.ActiveDatasheet.txtProjectName.ColumnHidden = False
End Sub
- George_HepworthJan 01, 2022Silver ContributorI'm glad to hear you worked it out. Continued success with the project.