From: Tim on
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

From: Jeanette Cunningham on
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" <tim.page.militia(a)gmail.com> wrote in message
news:3bf779bc-de53-45ef-a538-d356ed272151(a)f1g2000prf.googlegroups.com...
> 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
>


 | 
Pages: 1
Prev: Database hanging up
Next: Update Text Box