TastyWheat
Registered User.
- Local time
- Today, 07:19
- Joined
- Dec 14, 2005
- Messages
- 125
I have a subform in datasheet view and I wish to selectively hide columns I'm not using (depending on the query). I wrote a small function to make it easier. Here's my code:
So all I do is send the subform name while I'm using the parent form and then give it the column name to hide. Oddly enough this code works for columns such as "Net B" and "Net% +/-", but it doesn't work with the columns "Period B" or "Period A". On my subform the text boxes and their labels have the same name (if that even matters). I keep getting a 2465 error (field not found) no matter what I change the column name to.
Code:
Function HideColumn(myForm As SubForm, myLabel As String)
myForm.SetFocus
myForm.Controls(myLabel).SetFocus
DoCmd.RunCommand acCmdHideColumns
End Function