473,394 Members | 1,761 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Is it correct to call a Public Sub w/o enclosing arguments in parentheses?

MLH
SendMailPlusWithOE Subject, Message, Recipients, Files, "08"

I've seen the above syntax used to call the sub SendMailPlusWithOE

Is it correct/incorrect/good practice/bad practice or just a matter of
personal preference?
Jan 10 '07 #1
2 1318
It's correct syntax, so it boils down to style.

My presonal preference is to use the Call keyword, and include the brackets.
I find that's more readable and consistent across VBA versions, and the same
syntax works regardless of whether you are calling a Function or Sub, e.g.:
Call Text1_BeforeUpdate(Cancel)
Call MyFunctionWhereIDontCareAboutReturnValue(SomeVar)

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"MLH" <CR**@NorthState.netwrote in message
news:37********************************@4ax.com...
SendMailPlusWithOE Subject, Message, Recipients, Files, "08"

I've seen the above syntax used to call the sub SendMailPlusWithOE

Is it correct/incorrect/good practice/bad practice or just a matter of
personal preference?
Jan 10 '07 #2
"Allen Browne" <Al*********@SeeSig.Invalidwrote in
news:45***********************@per-qv1-newsreader-01.iinet.net.au:
It's correct syntax, so it boils down to style.

My presonal preference is to use the Call keyword, and include the
brackets. I find that's more readable and consistent across VBA
versions, and the same syntax works regardless of whether you are
calling a Function or Sub, e.g.:
Call Text1_BeforeUpdate(Cancel)
Call MyFunctionWhereIDontCareAboutReturnValue(SomeVar)
Try

MyFunctionWhereIDontCareAboutReturnValue SomeVar

I think you will find that it works as well.

--
lyle fairfield
Jan 10 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: ¤ Alias | last post by:
I have a function named getID3info (lvwDiscInfo.SelectedItem). What is the difference between getID3info (lvwDiscInfo.SelectedItem) and Call getID3info(lvwDiscInfo.SelectedItem) ?
4
by: Eric A. Johnson | last post by:
Hi All, I have a class, ConsoleWindow, that is a member of another class, ConsoleLib, like so: class ConsoleLib { public: class ConsoleWindow { public:
39
by: Randell D. | last post by:
Folks, I'm sure this can be done legally, and not thru tricks of the trade - I hope someone can help. I'm writing a 'tool' (a function) which can be used generically in any of my projects. ...
11
by: Neo | last post by:
Why the following code is compilable? The function abc() doesn't take any arguments, still i can call the function with arbitraty number of arguments. Even compiler doesn't show any warning. What...
6
by: Karl Hungus | last post by:
Im using an xsl transformation so its not practical to use controls in the usual way, but I would still like to call methods in my codebehind class. usually Id just use onclick="<eventHandler>"...
2
by: Ravi Uday | last post by:
Hi, Can some-one comment on below snippet ? static int xxx_list_compare (void *ptr1, void *ptr2) { if (ptr1 && ptr2 && (ptr1 == ptr2)) { return (0); } return (1); }
3
by: Mark | last post by:
So, I was looking at this code example by Bruce Eckel where he hides the copy constructor by making it private... but in his code I noticed that he writes NoCC n(); *with* parentheses. Now...
20
by: sam_cit | last post by:
Hi Everyone, I have the following code, int main() { int p = {10,20,30,40,50}; int *i = &p; printf("before : %p\n",(void*)i); printf("1 %d %d\n",*++i,*i++);
12
by: rshepard | last post by:
I'm a bit embarrassed to have to ask for help on this, but I'm not finding the solution in the docs I have here. Data are assembled for writing to a database table. A representative tuple looks...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.