SubForm to MainForm Navigation

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm having trouble setting the focus from a control on my subform back to the
MainForm. I've deleted the whole form and started over several times to be
sure I've got the name of the main form correct and I find it listed in the
Project Explorer, but cannot get it recognized in the code.

I've tried both "me.mainform.setfocus" and "form_mainform.setfocus".
I have this working fine on several other forms, but cannot figure out what
I've done wrong here. (only two controls on the main form and one on the
subform are enabled)
 
Hi, neenmarie.

Moving from a control on a subform to one on the main form (or vice versa)
is a little tricky--first you have to move to the form *itself*, then to the
specific control on the form. So for your situation, the code is:

Me.Parent.SetFocus
Me.Parent.Form!YourMainFormControl.SetFocus

Hope that helps.
Sprinks
 
Thank you. That's what I thought I was doing, but my code wasn't exactly
correct. Thx for your help.
 
Back
Top