Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sub and function compile problem

Status
Not open for further replies.

aperture

Programmer
Jul 25, 2001
22
US
i have a public function in a db module called within a private sub in a forms class module. the function is on the right side of an equals sign as follows, without the specific call command:

private sub a

curb= function c (params)

end sub

if the parameters are correct, and they have the correct scope, (which i believe they are and do), why would i recieve a 'sub or funtion not defined' error? am i trying to do something that cant be done?

if someone with more vba expereince can answer this question, or offer insight, i would really appreciate it.

thanks!

ap
 
Try taking the paranthesis out as:

curb=c params

VBA will evaluate the expression in paranthesis which can change the value passed.

Hope this Helps,
Rewdee
 
Hi

Do you really mean that you have "function" before the function name when you are calling it?

All the best

Keith
 
No, you don't need the "function" when you are calling it.

If you have the following function:

Function GetData(Par1 As Long, Par2 As String) As String
......
End Function

The call would look like this:

x = GetData(35, "Value")

It is always good practice to preceed it with "Public" if you want to get to it from the entire database:

Public Function GetData(Par1 As Long, Par2 As String) As String
Jim Lunde
compugeeks@hotmail.com
Custom Application Development
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top