I have a form in my app named frmMain

In the form I have a Sub

Public Sub mySub()
End Sub

and a function

Public Funtion GetValue() as Long
GetValue = 100
End Function


Now when I call mySub from another form, I do something like

Dim frM as frmMain

frmMain.mySub()

And that works fine..

But why can't I get the return value of the GetValue() function?

i.e

Dim frM as frmMain
Dim myValue as Long

myValue = frmMain.GetValue()

It returns an error, object reference not set to instance of an object...

Thanks