This is probably a syntax problem...
I have a dynamically created form that is used as a subform, I want to freeze a column on the subform when the main form opens. The following code works if used in the subform's OnOpen event:
...but I can't have it there since the subform is deleted and recreated when needed (or can I add the code on creation?).
If I put the equivalent into the main form's OnOpen even:
it tells me that "The command or action 'FreezeColumn' isn't available now" - runtime error 2046 - at the runcommand line.
Everything else works, and if I use the runcommand line in the immediate window it works, so I can only assume that the subform isn't in a state where the command can be used during the OnOpen event of the main form...?
Anybody know what's going on?
Thanks,
Phil
---------------
Pass me the ether.
I have a dynamically created form that is used as a subform, I want to freeze a column on the subform when the main form opens. The following code works if used in the subform's OnOpen event:
Code:
CODE.ColumnHidden = True
[SpeciesName].ColumnWidth = 3500
[SpeciesName].Locked = True
[SpeciesName].SetFocus
DoCmd.RunCommand acCmdFreezeColumn
...but I can't have it there since the subform is deleted and recreated when needed (or can I add the code on creation?).
If I put the equivalent into the main form's OnOpen even:
Code:
[SFBugsCountsheet].Form![CODE].ColumnHidden = True
[SFBugsCountsheet].Form![SpeciesName].ColumnWidth = 3500
[SFBugsCountsheet].Form![SpeciesName].Locked = True
[SFBugsCountsheet].Form![SpeciesName].SetFocus
DoCmd.RunCommand acCmdFreezeColumn 'error here
it tells me that "The command or action 'FreezeColumn' isn't available now" - runtime error 2046 - at the runcommand line.
Everything else works, and if I use the runcommand line in the immediate window it works, so I can only assume that the subform isn't in a state where the command can be used during the OnOpen event of the main form...?
Anybody know what's going on?
Thanks,
Phil
---------------
Pass me the ether.