referencing a control

  • Thread starter Thread starter Fay Yocum
  • Start date Start date
F

Fay Yocum

I have main form frmEducation, on that is a subfrmLearners.
On subfrmLearners that are two other subforms subfrmTelephones and
subfrmAddresses.
I want to tab from subfrmTelephones to subfrmAddresses the txtTelephoneTypes
control

I used the advise given last week and got everything to work when I was
dealing with just the subfrmLearners and it's two subforms.

As John Vinson suggested I put a hidden text box on the subfrmAddresses and
put the following into the Got Focus event of that textbox

Private Sub txtHidden_GotFocus()
Forms.frmLearners.subfrmTelephone.SetFocus
End Sub

But when I put the frmEducation into the mix it doesn't work.

How do I properly include the frmEducation into the line above.

Thank you.

Fay
 
It fails at the

Me.Parent.SetFocus
line. I did try Me!Parent.SetFocus and that didn't work either.

Thank you.

Fay
 
Try something like this:

Private Sub txtHidden_GotFocus()
If Me.Dirty Then 'Save first.
Me.Dirty = False
End If
Me.Parent.SetFocus
With Me.Parent.subfrmAddress.Form
.SetFocus
.txtTelephoneTypes.SetFocus
End With
End Sub
 
You can try dropping that line out, or replace it with:
Forms!frmEducation!subfrmAddresses.SetFocus
 
Back
Top