M
Mike
I am using a label as a menu button and need the OnClick event to set the
source object for a subform and then set focus to a certain control in the
subform.
Please see code below (Form1 has a control called TextBox2)
This following code works, but does not set the subform's source object (the
subform is already set to "SubForm1" and control could be anywhere):
With forms!MainForm
.SubForm1.SetFocus
.SubForm1!TextBox2.SetFocus
End With
This code does not work, because it includes the crucial step of setting the
source object (the subform's source object could already be "Form1"; once the
menu button is clicked, no control seems to have focus until I click down
again somewhere in the form):
With forms!MainForm
.SubForm1.SourceObject = "Form1"
.SubForm1.SetFocus
.SubForm1!TextBox2.SetFocus
End With
What am I missing here? Thanks
source object for a subform and then set focus to a certain control in the
subform.
Please see code below (Form1 has a control called TextBox2)
This following code works, but does not set the subform's source object (the
subform is already set to "SubForm1" and control could be anywhere):
With forms!MainForm
.SubForm1.SetFocus
.SubForm1!TextBox2.SetFocus
End With
This code does not work, because it includes the crucial step of setting the
source object (the subform's source object could already be "Form1"; once the
menu button is clicked, no control seems to have focus until I click down
again somewhere in the form):
With forms!MainForm
.SubForm1.SourceObject = "Form1"
.SubForm1.SetFocus
.SubForm1!TextBox2.SetFocus
End With
What am I missing here? Thanks