Me.YourControlNameHere.SetFocus
DoCmd.RunCommand acCmdFreezeColumn
Me.YourSecondControlNameHere.SetFocus
DoCmd.RunCommand acCmdFreezeColumn
Me.YourThirdControlNameHere.SetFocus
DoCmd.RunCommand acCmdFreezeColumn
[COLOR=navy]Private Sub[/COLOR] Form_Open(Cancel [COLOR=navy]As Integer[/COLOR])
Me.Field1.ColumnHidden = [COLOR=navy]True[/COLOR]
Me.Field2.ColumnHidden = [COLOR=navy]True[/COLOR]
Me.Field3.ColumnHidden = [COLOR=navy]True[/COLOR]
[COLOR=navy]End Sub[/COLOR]
Hello, geoB,
Let me see if I can simplify this for you. Imagine that your datasheet form has the following fields: Field1, Field2, Field3, Field4, Field5. Let's say that you want to hide Field1, Field2 and Field3. Here's some code that you could use within your Form's Code Module, in the Open event, for Example:
Code:[COLOR=navy]Private Sub[/COLOR] Form_Open(Cancel [COLOR=navy]As Integer[/COLOR]) Me.Field1.ColumnHidden = [COLOR=navy]True[/COLOR] Me.Field2.ColumnHidden = [COLOR=navy]True[/COLOR] Me.Field3.ColumnHidden = [COLOR=navy]True[/COLOR] [COLOR=navy]End Sub[/COLOR]
Whoop, my bad, need more coffee!
Me.YourControlNameHere.SetFocus
DoCmd.RunCommand acCmdFreezeColumn
Me.YourSecondControlNameHere.SetFocus
DoCmd.RunCommand acCmdFreezeColumn
Me.YourThirdControlNameHere.SetFocus
DoCmd.RunCommand acCmdFreezeColumn
DoCmd.OpenTable "BB_Download", acViewNormal, acReadOnly
DoCmd.RunCommand acCmdFreezeColumn
You don't freeze it in the table. You freeze it on the form. What's this open table stuff?Either I'm thick or I wasn't clear. Here's the context in which I'm trying to freeze columns:in which case any subsequent command beginning with Me. throws the error "Invalid use of Me keyword."Code:DoCmd.OpenTable "BB_Download", acViewNormal, acReadOnly DoCmd.RunCommand acCmdFreezeColumn
George
I see where the table came from. Don't use tables directly. Open a form in datasheet view with the table as the underlying recordsource. Then the code I gave you will work.Assuming a table is open in datasheet view,