Link to home
Start Free TrialLog in
Avatar of thorner
thorner

asked on

Function Trouble

I have a function that I am trying to call and for some reason I can't get it to work.  The function is not complete yet but here's what I have so far:

Function Validate(Entered As String, TypeEntered As Integer, FieldName As String)

    If TypeEntered = 0 Then
        If Entered = "" Then
            Trim (Entered)
            Entered = InputBox("There must be an entry in the " + FieldName + " field.  Please enter it below.")
        End If
    End If
   
End Function

Every time I try to call the function gives me the error:
Expected:=
I don't understand.  The way I tryed to call it is:

Validate(txtFirstName.text, 0, "First Name")

HELP!!!!!
ASKER CERTIFIED SOLUTION
Avatar of fguerreiro_inix
fguerreiro_inix

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of thorner
thorner

ASKER

But what value does it return to something?

Function Validate(Entered As String, TypeEntered As _
    integer,FieldName As String)as boolean

    Validate= true
   
    If TypeEntered = 0 Then
        If Entered = "" Then
            Trim (Entered)
            Entered = InputBox("There must be an entry in the _
                + FieldName + " field.  Please enter it below.")
            Validate= false
        End If
    End If
     
End Function

You should say what kind of value the function returns.

Function blabla(aaa As String, bbb As integer) as boobean

and the function blabla returns a boolean. Inside the function you must assign the value you want to return (true or false).
If you don't specify the type of the return value it will return a variant.

Hope this helps
Regards