My Assistant
![]() ![]() |
|
|
Oct 23 2007, 11:02 AM
Post
#1
|
|
|
UtterAccess Member Posts: 31 |
Hello all,
I can't seem to get the correct syntax to execute code that exists in the on_click event of a button on a subform. I have mainform, mainformbutton, subform and subformbutton. Subform is a continuous form. In the mainformbutton on_click event i do a few things and then want to call a button on the subform to do some repositioning on the subform. Can I use the Call approach? If so I would appreciate assistance on how to write the code. Thanks |
|
|
|
Oct 23 2007, 12:49 PM
Post
#2
|
|
|
UtterAccess VIP Posts: 5,279 From: Upstate NY, USA |
Your first hurdle is that a form's events are declared as Private by default.
You need to change the Private keyword to Public before you can call the code form outside the form's code module. Personally I would not put code in any event if I wanted to run it from another module. I would create a separate public sub routine and call that routine from the Click event and where ever else was necessary. |
|
|
|
Oct 23 2007, 01:07 PM
Post
#3
|
|
|
UtterAccess Member Posts: 31 |
The code is in a public sub on the subform. I needed the syntax to call it from the main form.
|
|
|
|
Oct 23 2007, 03:47 PM
Post
#4
|
|
|
UtterAccess VIP Posts: 5,279 From: Upstate NY, USA |
From the mainform code module:
Call Me.subform.Form.PublicSubName |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 23rd May 2013 - 03:16 PM |