Solved

Function Trouble

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month4 days, 5 hours left to enroll

630 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