Solved

How to call a subroutine located in a different form

Posted on 2002-07-02
3
166 Views
Last Modified: 2010-05-02
How can I call a subroutine that in a totally different form?
0
Comment
Question by:Draner
  • 2
3 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 7125674
the subroutine needs to be public and you call it this way:

FormName.SubRoutineName
0
 

Accepted Solution

by:
carlosferreira earned 50 total points
ID: 7125713
In the form which has the subroutine you want to call ensure that the subroutine is Public.  

eg.
Public Hello()
  MsgBox "Hello World"
End Sub

For sake of arguement also call this form "FormWithRoutine"

In the form you are calling from type the name of the Form with the subroutine, type a period, and the specify the name of the Routine you which to call.  In the example given above it would be:

FormWithRoutine.Hello
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 7125716
another newbie!!!

carlosferreira, your post is not an answer. You can read at the bottom of this screen :
"Answers
An answer is a specific solution to a question and should be submitted if it will solve the questioner's problem and doesn't duplicate a previous comment. "

Also, you made a mistake. It should be read: Public SUB Hello()
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question