All you need in order to keep using parens is to 'call' the sub:
Call DeleteXXRecord(A, B)
"Lyn" <l.hancock@iiNet.net.auwrote in message
news:t2orusctal4l$.1xove5w6shju1.dlg@40tude.net...
Quote:
Can anyone explain this for me?
>
A sub procedure can be called with or without parentheses around the
arguments. By personal convention, I normally use parentheses. I am in
the middle of a fairly large project (for me), happily using parentheses
everywhere -- until this happened:
>
The following sub is defined in a class module.
>
Public Sub DeleteXXRecord(lngEORekNombro As Long, lngXXRekNombro As Long)
[..code..]
End Sub
>
In another (form) module, I call the sub thus:
>
Dim A As Long
Dim B As Long
>
A = [some long number]
B = [some long number]
>
DeleteXXRecord(A, B)
>
While typing this last line, Intellisense seems to be quite happy with
what
I am typing. But as soon as I newline after entering the line, it turns
red. Doing a compile gives me "Syntax error" on this line.
>
I have been agonizing over what could be wrong with such a simple sub
call,
trying to cut down the code to the bare basics -- all to no avail. Until
in desperation I decided to try deleting the parentheses -- thus:
>
DeleteXXRecord A, B
>
Lo and behold, this actually compiled error-free. The only sub call in
the
whole project without parentheses!
>
I know that many people don't use use parentheses with sub calls. I do it
mainly for consistency with function calls (I've gotten into the habit).
As far as I know, parentheses around a sub's arguments should always work.
>
Have I got this wrong somehow???
>
Thanks for any help,
Lyn.