Shift focus to parent subform?

R

roger

A form with a subform that has a nested subform.
on a certain event we:

DoCmd.OpenForm ("frmMAINFORM") ' open mainform
DoCmd.GoToControl "sbfrmSUBFORM1" ' goto subform
DoCmd.GoToControl "ItemID" ' goto record number control
DoCmd.FindRecord lngItemID ' find our record

that works. Here's the problem:
There is a subform on "sbfrmSUBFORM1" lets call it "sbfrmSUBFORM1-A"
somtimes the user is in "sbfrmSUBFORM1-A" when the event fires.
In that case, my code crashes on line 3 because there is no control named
ItemID in "sbfrmSUBFORM1-A"

I can sense if the focus is on the sub-subform with:
If Screen.ActiveControl.Parent.Name = "sbfrmSUBFORM1-A" Then ...
but my question is:

then...WHAT?

How do i actually get the focus back to the parent subform?
I can't seem to get the syntax right to use either a
docmd.gotocontrol
or a
Screen.ActiveControl.Parent.(.parent?).Setfocus
command to get the focus back to subform1

what do i do?

aha tia
roger
 

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

Top