Calling a subroutine in another module (1 Viewer)

rockman

Senior Member
Local time
Today, 02:40
Joined
May 29, 2002
Messages
190
This may be a stupid question but...

I have a form that opens a second form. I'd like to have the first form call a particular subroutine of the second form. Here's what I have:

Form1 Module
-----------------
DoCmd.Open "Form2"
Call SetupForm(Param1, Param2) 'This subroutine is in Form2

Form2 Module
-----------------
Public Sub SetupForm(Param1 as Long, Param2 as Long)
....
End Sub

This errors at the "Call" statement saying "Subroutine not defined".

Any thoughts?... Thx,
Jeff
 

raskew

AWF VIP
Local time
Today, 04:40
Joined
Jun 2, 2001
Messages
2,734
Easiest way is to move sub SetUpForm() to a public module, where it will then be available from anywhere in the application.

Lookup Scoping Levels in the help file for a more detailed discussion.
 

rockman

Senior Member
Local time
Today, 02:40
Joined
May 29, 2002
Messages
190
Thx
 

Users who are viewing this thread

Top Bottom