Compilation error expected = 
Author Message
 Compilation error expected =

Hello,

I've written a function with three variables:

Function FunctionName(Var1 As String, Var2 As Single, Var3 As Single)

I try to call this function from a form's event, but I keep getting the
'compilation error, = expected' message, when I write
FunctionName(Name,1,3). If I skip the ,1,3 all together there's no
compilation error message (ofcourse the function won't work then). It's
meant to send a prewritten e-mail...

What can be wrong? I have another function with the same variables, which
dosen't give me problems, but this other function returns a single, so....

Thanks
Ulrik

--------------------------------
"I'm not a vegetarian because I love animals. I'm a vegetarian because I
hate plants."
A. Whitney Brown



Sun, 08 Feb 2004 15:49:19 GMT  
 Compilation error expected =

Quote:

> Hello,

> I've written a function with three variables:

> Function FunctionName(Var1 As String, Var2 As Single, Var3 As Single)

> I try to call this function from a form's event, but I keep getting the
> 'compilation error, = expected' message, when I write
> FunctionName(Name,1,3). If I skip the ,1,3 all together there's no
> compilation error message (ofcourse the function won't work then). It's
> meant to send a prewritten e-mail...

> What can be wrong? I have another function with the same variables, which
> dosen't give me problems, but this other function returns a single, so....

> Thanks
> Ulrik

> --------------------------------
> "I'm not a vegetarian because I love animals. I'm a vegetarian because I
> hate plants."
> A. Whitney Brown

How are you calling the function? Is it supposed to return a value? If not
turn it into a Sub as a function is supposed to return a value (hence the
error)

Hope this helps

Tony Oakley



Sun, 08 Feb 2004 17:47:14 GMT  
 Compilation error expected =
Thanks! Explains a bit... :-)

Ulrik


Quote:

> > Hello,

> > I've written a function with three variables:

> > Function FunctionName(Var1 As String, Var2 As Single, Var3 As Single)

> > I try to call this function from a form's event, but I keep getting the
> > 'compilation error, = expected' message, when I write
> > FunctionName(Name,1,3). If I skip the ,1,3 all together there's no
> > compilation error message (ofcourse the function won't work then). It's
> > meant to send a prewritten e-mail...

> > What can be wrong? I have another function with the same variables,
which
> > dosen't give me problems, but this other function returns a single,
so....

> > Thanks
> > Ulrik

> > --------------------------------
> > "I'm not a vegetarian because I love animals. I'm a vegetarian because I
> > hate plants."
> > A. Whitney Brown

> How are you calling the function? Is it supposed to return a value? If not
> turn it into a Sub as a function is supposed to return a value (hence the
> error)

> Hope this helps

> Tony Oakley



Sun, 08 Feb 2004 19:13:48 GMT  
 Compilation error expected =
Hi Ulrik,
If you use brackets then a return value
is expected. Lose the brackets and you'll
be okay.

As an example, take the native MsgBox function.

If you use it like so:
MsgBox "Hi"
you do not use brackets because you're not
returning a value.

If you use it like:
Response = MsgBox("Do you want to do this?",vbOkCancel)

Then you need brackets.
HTH
Dan

Quote:

> Hello,

> I've written a function with three variables:

> Function FunctionName(Var1 As String, Var2 As Single, Var3 As Single)

> I try to call this function from a form's event, but I keep getting the
> 'compilation error, = expected' message, when I write
> FunctionName(Name,1,3). If I skip the ,1,3 all together there's no
> compilation error message (ofcourse the function won't work then). It's
> meant to send a prewritten e-mail...

> What can be wrong? I have another function with the same variables, which
> dosen't give me problems, but this other function returns a single, so....

> Thanks
> Ulrik

> --------------------------------
> "I'm not a vegetarian because I love animals. I'm a vegetarian because I
> hate plants."
> A. Whitney Brown



Mon, 09 Feb 2004 19:53:30 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Compilation error: Automation Error (Error 440)

2. Compilation error/Automation error

3. On error Goto causes error in compilation

4. Compilation Error, Compacting Error

5. 16-bit compilation in 32-bit compilation

6. SOA_GLOB compilation error : Help !

7. Compilation Error

8. Compilation Error 424

9. Compilation error

10. Compilation error - Help!

11. Trapping compilation-errors

12. Compilation error with recored macro

 

 
Powered by phpBB® Forum Software