Calling a Sub in Another Form vs a Module 
Author Message
 Calling a Sub in Another Form vs a Module

It sounds like you are trying to call the sub by its name only. You must
treat a form like another object because it is another object. For example:

Try
    Call Form2.SubName

not
    Call SubName   <<<< this doe work if in .bas because a bas module is not
considered an object just a collection of Global Routines and declarations
(except of course those declared as private)

Quote:

>From Form1, I'm trying to call a Public SUB in Form2, but it fails
>with the diagnostic, "Compile error.  Sub or Function not defined."
>If I relocate (cut & paste) the SUB to Module1, it works fine.

>The help says using 'Public' makes the Sub accessible to all other
>procedures throughout the program.

>Anybody know why it won't work in the second Form, but does of a BAS
>module?

>jim

>___

>Have a home repair question?  Try my help page.  It's sort of an

alt.home.repair FAQ.

- Show quoted text -

Quote:

> http://www.*-*-*.com/



Mon, 10 Jul 2000 03:00:00 GMT  
 Calling a Sub in Another Form vs a Module

Public works to make it public when placed in a module, not a form, I think
there is a way to do it, but I am not sure, anyways your program shouldn't
need mnuch updating if placed in a module versus a form, should it?   You
just have to get used to it is all, it took me a while too.

--
Please e-mail a copy of the response to

Sometimes my news server does not function properly,
Thank You.

Quote:

>From Form1, I'm trying to call a Public SUB in Form2, but it fails
>with the diagnostic, "Compile error.  Sub or Function not defined."
>If I relocate (cut & paste) the SUB to Module1, it works fine.

>The help says using 'Public' makes the Sub accessible to all other
>procedures throughout the program.

>Anybody know why it won't work in the second Form, but does of a BAS
>module?

>jim

>___

>Have a home repair question?  Try my help page.  It's sort of an

alt.home.repair FAQ.

- Show quoted text -

Quote:

>http://www.ghgcorp.com/jevans/HomeRepair.htm



Tue, 11 Jul 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. module sub called from within form

2. Bad Calling Convention error 49 - due to calling a Sub in a .bas module

3. Q: Code Module vs UserControl (Form, Class) module.

4. Q: Code Module vs UserControl (Form, Class) module.

5. Q: Code Module vs UserControl (Form, Class) module.

6. ??Calling Sub-Menu_Click from Module Level Procedures???

7. calling a sub inside a usercontrol from a module

8. calling a sub inside a usercontrol from a module

9. calling a sub inside a usercontrol from a module

10. How to call a sub defined in DLL module not belong to any class

11. How to call a form routine from a module by the form handle

12. Passing Value from Module Function to Form sub problem

 

 
Powered by phpBB® Forum Software