473,779 Members | 2,072 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

MLH
SendMailPlusWit hOE Subject, Message, Recipients, Files, "08"

I've seen the above syntax used to call the sub SendMailPlusWit hOE

Is it correct/incorrect/good practice/bad practice or just a matter of
personal preference?
Jan 10 '07 #1
2 1341
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_BeforeUpd ate(Cancel)
Call MyFunctionWhere IDontCareAboutR eturnValue(Some Var)

--
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**@NorthStat e.netwrote in message
news:37******** *************** *********@4ax.c om...
SendMailPlusWit hOE Subject, Message, Recipients, Files, "08"

I've seen the above syntax used to call the sub SendMailPlusWit hOE

Is it correct/incorrect/good practice/bad practice or just a matter of
personal preference?
Jan 10 '07 #2
"Allen Browne" <Al*********@Se eSig.Invalidwro te 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_BeforeUpd ate(Cancel)
Call MyFunctionWhere IDontCareAboutR eturnValue(Some Var)
Try

MyFunctionWhere IDontCareAboutR eturnValue 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
46967
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
1691
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
6554
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. When it completes, it can call a success, or a failure function. The names of these success, or failure functions will differ, and I'd like to know how I can pass the name of a function to my tool, and how my tool can call the function, using that...
11
1932
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 the standard says? ----- file1.c ------ extern unsigned abc(); int main() { unsigned *chip_offset; abc(&chip_offset, 10);
6
1402
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>" say for something like a button control is there a way to manually call a method defined in a codebehind class, but is not called by a standard control? I looked at the __doPostBack() function that .net generates but it seemed impenetrable.
2
1286
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
2199
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 I've learnt that this does *not* actually call the default constructor (which leads me to the main question later on..) ..but then, what exactly is n? Seems like an uninitialized reference to NoCC...
20
1813
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
4168
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 like this: ('eco', "(u'Roads',)", 0.073969887301348305) Pysqlite doesn't like the format of the middle term: pysqlite2.dbapi2.InterfaceError: Error binding parameter 1 - probably
0
9474
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10139
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10075
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9931
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7485
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6727
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5504
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2869
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.