Solved

Function Trouble

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now