Solved

Function Trouble

Posted on 1998-11-06
3
163 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 50 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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.
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 process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

752 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