Returning Values from a Sub/Function

Timko

New member
Local time
Today, 16:09
Joined
Jun 17, 2004
Messages
8
Hi, I have a question that hopefully someone will be able to answer. I am just starting to write some code in Access 97 and I am trying to create a function that I can call, which returns a value depending on an integer that is given when the function is called.

But I can't work out how to return the string that is created to the sub that originally calls the function.

Can anyone help?

Thanks

Timko
 
You must return the name of the function within itself:

Code:
Public Function X(intValue As Integer) As Boolean
    X = IIf(intValue < 0, False, True)
End Function




Code:
If X(myValue) = True Then
    MsgBox "Positive"
Else
    MsgBox "Negative"
End If
 
Thanks :) , this is exactly what i was after.

Tim
 

Users who are viewing this thread

Back
Top Bottom