Cannot run sub in another form's module

whenthegeeseinvade

Registered User.
Local time
Today, 05:17
Joined
Nov 12, 2008
Messages
39
I have a main form with two subforms (sbf1 & sbf2)

sbf1 has a module which contains a subroutine that is run by clicking a button. sbf2 has a combo box which I would also like to trigger the subroutine which resies in the module of sub1.

I have tried declaring the subroutine as public in sbf1 and calling it from sub2 but is says that the subroutime is not defined.

I am sure I'm missing something simple and would really appreciate a pointer in the right direction.

Many thanks,

Laurence
 
Thanks Ruralguy

After lots of trial and error, I ended up using:

Call Form_sbfProjectJobs.cmdScheduleJob_Click

Still don't understand when the underscore is required rather than using Forms! but that's how ir appears in the project window of the VBA editor and it seems to work.
 
Assuming you are on the MainForm and sbfProjectJobs is the name of your SubFormControl then I would have used:
Call Me.sbfProjectJobs.FORM.cmdScheduleJob_Click
 

Users who are viewing this thread

Back
Top Bottom