Freezing first column in a datasheet

johnbirt

Registered User.
Local time
Today, 11:24
Joined
Oct 31, 2009
Messages
20
Hunting around I see that his has been covered before for form control but my requirement was for a control in a subform and I needed all this to affect a first column freeze.

The code was in the Onload for the main form.
Code:
Dim ctl As Control
Set ctl = Forms("frmPlanner").Controls("subfrmTempCtrl")
Me.SetFocus
ctl.SetFocus
ctl.Form.Controls(0).SetFocus
DoCmd.RunCommand acCmdFreezeColumn

It does work but I can't fathom why I need more than the last .SetFocus. Leave any of the prior ones out and it gives an error to the effect that can't do it in those circumstances. I understand the control has to have focus for it to work but why are the other's required?

Explanation would be most helpful. Thanks.

John B
 

Users who are viewing this thread

Back
Top Bottom