A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Newbie Sub calling question



 
 
Thread Tools Display Modes
  #1  
Old November 20th, 2009, 01:32 AM posted to microsoft.public.access.forms
Tim
external usenet poster
 
Posts: 1
Default Newbie Sub calling question

Why is it that when I call a subroutine with one variable, I can do
this without generating an error:

MySub("some text")

But if I reconstruct the sub such that it has two variables and then
call it like:

MySub("some text", 1)

I get an error that says "expected: ="

So that I need to do:

Dim foo as Integer

foo = MySub("some text", 1)

?

I'm certain this is a very simple issue, but I tried Googling around
and all the examples of subs have a single variable.

Thanks for your answers.


Tim

  #2  
Old November 20th, 2009, 02:15 AM posted to microsoft.public.access.forms
Jeanette Cunningham
external usenet poster
 
Posts: 2,190
Default Newbie Sub calling question

There are 2 different syntaxes to choose from.

1. Call MySub("some text",1)

2. MySub "some text", 1

Note that 1. has brackets, but no spaces between the name of the sub and the
variables, which is different from 2.



Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

"Tim" wrote in message
...
Why is it that when I call a subroutine with one variable, I can do
this without generating an error:

MySub("some text")

But if I reconstruct the sub such that it has two variables and then
call it like:

MySub("some text", 1)

I get an error that says "expected: ="

So that I need to do:

Dim foo as Integer

foo = MySub("some text", 1)

?

I'm certain this is a very simple issue, but I tried Googling around
and all the examples of subs have a single variable.

Thanks for your answers.


Tim



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:33 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.