Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Function Trouble

Posted on 1998-11-06
3
Medium Priority
?
175 Views
Last Modified: 2010-04-30
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!!!!!
0
Comment
Question by:thorner
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
fguerreiro_inix earned 100 total points
ID: 1443589
A function should return a value.

You must assign a variable of the same type of the function's returned value.

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

Hope this helps
Regards
0
 

Author Comment

by:thorner
ID: 1443590
But what value does it return to something?
0
 
LVL 3

Expert Comment

by:fguerreiro_inix
ID: 1443591

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




0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question