Calling Public Function

  • Thread starter Thread starter nomadk
  • Start date Start date
N

nomadk

A2003 SP2

I have the following public function:

"Public Function FindPath()
Dim strPath As String

strPath = CurrentProject.Path
Debug.Print strPath
End Function"

If I run this from the module window Debug.Print strPath returns the correct
path in the immediate window.

I created a text box on an unbound form and set the data source to:

"=FindPath()", but nothing shows in the text box when the form is displayed.
Shouldn't this work?

Thanks
 
Try this:

Public Function FindPath() as String
FindPath = CurrentProject.Path
End Function"

You were fine except for two minor details. Set the return type "as
String", and make the function equal to the final value "FindPath =".
 
Thank you

Magius96 said:
Try this:

Public Function FindPath() as String
FindPath = CurrentProject.Path
End Function"

You were fine except for two minor details. Set the return type "as
String", and make the function equal to the final value "FindPath =".
 
Back
Top