Open form - go to a subform

  • Thread starter Thread starter Tammy F
  • Start date Start date
T

Tammy F

Here is what I am trying to do. I have a main form - with several subforms -
I have an add button that opens frm_addcustomerresearch. When I close it and
re-open the main form - I'd like it to go to the subform that I just came
from. (Each subform opens to the same add form.)
I have a textbox on my add form that will write the subform name in it, then
as I close I'd like to refer to that field to go to the correct subform.

On the add form: [formnametxt] field has the following in it:
Forms.[Frm_AP_CustomerResearch].[Frm_AP_CR_2]

The on-click close button has the following:
Dim gotocntrl As Control
Let gotocntrl = Me!FormNametxt

DoCmd.RunCommand acCmdSaveRecord
DoCmd.Close
DoCmd.OpenForm "frm_ap_customerresearch"
DoCmd.GoToControl gotocntrl

I'm pretty sure it is mostly a referencing issue - but I have tried many
different variations - and nothing works.
Thank you!
 
It was a referencing issue. Since I was technically already on the form I
wanted to be, I didn't need anything but the subform name itself. Thanks.
 
Back
Top