Calling Public Function

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
 
M

Magius96

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 =".
 
N

nomadk

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 =".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top