It is still the case, but somehow 'fuzzy'.
As example, have a public function in a standard module:
-------------------------------
Public Function MyPopUp()
MsgBox "hello"
MyPopUp = True
End Function
------------------------------
Then, in the Debug Immediate Window, you can try:
MyPopUp
it works and return nothing as a SUBROUTINE does.
MyPopUp( )
a runtime ERROR occurs since it is a FUNCTION call and nothing is done
to capture the result.
Call MyPopUp( )
returns nothing, but does not produce an error either. The CALL make it
clear it is a SUBROUTINE behavior that you want, and is equivalent to the
first case.
? MyPopup
and
? MyPopup()
returns true, both working as FUNCTION.
You can also play a little with MsgBox "Hello". Add parenthesis:
MsgBox("hello")
and VBA will re-write the line as:
MsgBox ("hello")
to indicate you that MsgBox is used as SUBROUTINE.
If you preceed it with Call. VBA re-write the line by sticking the ( to the
procedure name:
Call MsgBox( "hello" )
and it is used as subroutine.
Finally, you can use:
Dim i As Long
i = MsgBox("hello")
and observe that here again, VBA sticks the ( to the procedure name, and
behave as a FUNCTION rather than a SUBROUTINE.
So, in some context, the ( ) or their absence may make a difference, and can
even generate a runtime error! So, they are important.
Vanderghast, Access MVP
Dale_Fye via AccessMonster.com said:
John,
May be a hold-over from an earlier version.
Dale
John said:
Dale,
Hmm. I always thought it was. Guess I will have to test that and see why
I
thought it was necessary to have the () at the end to actually get
something
to return.
I guess I learned something.
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
[quoted text clipped - 23 lines]
continues to run the rest of that event, which I don't want it to
do. How do
I handle this?