setting focus - sub form

  • Thread starter Thread starter Alex H
  • Start date Start date
A

Alex H

Hi, if I have focus in subform 1, and I want to programme to filla field in
subform2 on the sameparent, can someone tell me what the coorrect syntax is
to get focus on the second form.

i have tried : Me.parent.subform2name,but that doesnt seem to work

tks

Alex
 
Alex H said:
Hi, if I have focus in subform 1, and I want to programme to filla
field in subform2 on the sameparent, can someone tell me what the
coorrect syntax is to get focus on the second form.

i have tried : Me.parent.subform2name,but that doesnt seem to work

You shouldn't have to set the focus to that control in order to set its
value. Have you tried

Me.Parent!subform2name!ControlName = <some value>

? Note that "subform2name" must be the name of the subform *control* on
the main form, which is not necessarily the same as the name of the form
being displayed by that control. Of course, you should substitute the
name of the control on the subform for "ControlName" in the above.

If you do need to set the focus to the control on the other subform, you
probably need to use SetFocus twice: once for the main form and once
for the subform. Try this:

Me.Parent!subform2name.SetFocus
Me.Parent!subform2name.Form!ControlName.SetFocus
 
Thanks Dirk - that worked a treat was getting my !'s and .'s mixed up I
think
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top