Sub be used in other FORMs ?

  • Thread starter Thread starter Martin \(Martin Lee\)
  • Start date Start date
M

Martin \(Martin Lee\)

In one of my FORMs, I wrote the following VBA ( I want to make this sub ai()
useable in all other forms ) :

Sub ai()

Dim sqsrps As String

If [income] * [period] <= [cost] Then
sqsrps = "INCOME TOO LOW"
End If

MsgBox sqsrps, , "Alert!"

End Sub

-------------------------------------

Then, I want to "reuse" this SUB in other FORMs.

So that I set a BUTTON on this other FORM, the VBA of this button is:

Private Sub Command692_Click()
ai()
End Sub

-------------------------------------------

However, it cannot work.

Why and How to solve this problem.

Thank you.


Martin Lee
 
I solved the problem.

Using Module to contain the sub ai()

Thanks!

Martin Lee
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top