View Full Version : Public Function


arkres
12-17-2001, 11:32 AM
Hello. I have written a public function as follows:

Public Function FullName() As String

FullName = FirstName & " " & LastName


End Function

The function is contained in a module.

When I try to call this function to use on a form, I get an error message "variable not defined"

I'm a new user and I'd appreciate any help here. Thanks a lot.

Pat

Jack Cowley
12-17-2001, 12:10 PM
You have to pass the FirstName and LastName to the function as it has nothing to work with otherwise.

Public Function FullName(Fname As String, Lname As String) As String

FullName = Fname & " " & Lname

End Function

Call you function with: FullName([FirstName],[LastName]). Change FirstName and LastName to the actual names of the fields on your form.