Open form - go to a subform

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!
 
T

Tammy F

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.
 

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