Transfer control from one form to another

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

Guest

I have a form that opens a second , separate form. How do I transfer control
back to the initial form without closing the second form?

Traveler
 
It depends on how you opened the second form. If you opened it with the
acDialog window mode argument, then the pop-up was opens modal and you will
need to close it or hide it (.Visible = False) to return the focus to the
calling form. If the form wasn't opened modal and the calling form is still
open and visible (can be behind another window but not set to Visible =
False), you should be able to set focus to that form.

Forms!frmMyForm.SetFocus

This will set the focus to the form and the control on the form that last
had the focus. If you want the focus to go to a different control, you would
need to specify the control also.
 
Thanks, Wayne. I opened the form via a macro using the OpenForm command.
When I try to do a 'GotoControl' from the opened form it tells me that there
is no such field name in the current record. Is it because the two forms are
based on different tables?
 
Simply issuing GoToControl from a macro will try to set the focus to that
control on the active form. If that control isn't on that form, then you
will get what you are getting. So, basically, the answer to your question
is, yes. You would need to move the focus to the other form first or you may
try specifying the full path to the control and see if that works.

Forms!OtherFormName!ControlName
 
Back
Top