RunMacro when a page is selected

  • Thread starter Thread starter Krisse Arthur
  • Start date Start date
K

Krisse Arthur

I have a form with a page control. I want a macro to run
automatically when the user clicks on Page 2.

The Page Name is Client Summary and the macro is
mcrAction. I used the code builder and just filled in the
DoCmd line below. My code in On Click is the following:

Private Sub Client_Summary_Click()
DoCmd.RunMacro (mcrAction)
End Sub


When I open page 2 (Client Summary) the macro does not
execute.

This page displays a subform with data that will be
affected by mcrAction.

Any ideas?

Thanks!
 
Use the Change event of the tab control, instead of the Click event of the
page.

If the form is named "Form1", and the tab control is named "Tab1", the
condition column of your macro would be:

[Forms]![Form1]![Tab1].Value = [Forms]![Form1]![Client
Summary].[OptionValue]

If you don't see a Condition column in your macro, it's on the View menu.
 
Thanks, Allen!
-----Original Message-----
Use the Change event of the tab control, instead of the Click event of the
page.

If the form is named "Form1", and the tab control is named "Tab1", the
condition column of your macro would be:

[Forms]![Form1]![Tab1].Value = [Forms]![Form1]![Client
Summary].[OptionValue]

If you don't see a Condition column in your macro, it's on the View menu.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to the newsgroup. (Email address has spurious "_SpamTrap")
I have a form with a page control. I want a macro to run
automatically when the user clicks on Page 2.

The Page Name is Client Summary and the macro is
mcrAction. I used the code builder and just filled in the
DoCmd line below. My code in On Click is the following:

Private Sub Client_Summary_Click()
DoCmd.RunMacro (mcrAction)
End Sub


When I open page 2 (Client Summary) the macro does not
execute.

This page displays a subform with data that will be
affected by mcrAction.

Any ideas?

Thanks!


.
 
Back
Top