Calling Functions Between Nested Subforms

W

wrldruler

Hello again,

I started out with 2 forms -- a main form and a sub-form:
(1a) mainfrm_Forecast_Input_Project
(1b) subfrm_Forecast_Input_Project_Details

I was successfully calling functions between them using these two
syntaxes:

1a to 1b: Me.subfrm_Forecast_Input_Project_Details.Form.MyFunction1
1b to 1a: Forms!mainfrm_Forecast_Input_Project.MyFunction2

Then I decided I need to drop 1a into a new main form, thus creating a
nested subform situation:

(1a) new_mainfrm_Forecast
(1b) old_mainfrm_Forecast_Input_Project
(1c) subfrm_Forecast_Input_Project_Details

Now my function calls are breaking.

Can you give me the correct syntax to call functions from 1b to 1c, and
then 1c to 1b.

Thanks,

Chris
 
M

Marshall Barton

wrldruler said:
I started out with 2 forms -- a main form and a sub-form:
(1a) mainfrm_Forecast_Input_Project
(1b) subfrm_Forecast_Input_Project_Details

I was successfully calling functions between them using these two
syntaxes:

1a to 1b: Me.subfrm_Forecast_Input_Project_Details.Form.MyFunction1
1b to 1a: Forms!mainfrm_Forecast_Input_Project.MyFunction2

Then I decided I need to drop 1a into a new main form, thus creating a
nested subform situation:

(1a) new_mainfrm_Forecast
(1b) old_mainfrm_Forecast_Input_Project
(1c) subfrm_Forecast_Input_Project_Details

Now my function calls are breaking.

Can you give me the correct syntax to call functions from 1b to 1c, and
then 1c to 1b.


Unless you changed the name of subform1c's subform control,
the 1a to 1b call should still work when it's used in the 1b
to 1c arrangement.

The call from 1c to 1b is best done using:
Me.Parent.MyFunction2
or just:
Parent.MyFunction2
either of which would have worked in your old arrangement.
 
W

wrldruler

Unless you changed the name of subform1c's subform control,
the 1a to 1b call should still work when it's used in the 1b
to 1c arrangement.


Turns out the 1a to 1b syntax was correct all along. It was calling the
first function correctly, but the error was on a sub-function. The
debugger was just bringing me to the wrong code.

The call from 1c to 1b is best done using:
Me.Parent.MyFunction2
or just:
Parent.MyFunction2
either of which would have worked in your old arrangement.

Me.Parent worked great. Once I replaced all the necessary code in all
my functions, then everything started working again.

Thanks,

Chris
 

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

Similar Threads


Top