First let me say that I am very, very new to FoxPro and finding just the basics a bit of a learning curve.
I am attempting to create a program file (.prg) that has some public functions that I can call from my main code. I have added the program file "publicfunctions.prg" and included a simple function that returns a hard coded literal (just trying to make the mechanics work)
*!* This function is in the publicfunctions.prg file
FUNCTION GetFieldValue
RETURN 'This is the value'
ENDFUNC
Then in my main program I attempt to use it but I am getting the error that the file does not exist. Here is the entirety of the code in the main program
*!* This is the main program logic
SET PROCEDURE TO publicfunctions.prg
PRIVATE sFieldValue = ''
sFieldValue = GetFieldValue()
The error that I am getting is on the 'SET PROCEDURE TO publicfunctions.prg' statement. It is: "File 'publicfunctions.prg" does not exist."
I'm guessing that it can't find it because the default directory is not set to the path where the file exists. I tried adding the "SET DEFAULT TO" statement prior to the "SET PROCEDURE TO" statement but it didn't change the outcome at all.
I don't want to hard code the path so I guess my questions are these:
- Is my assumption correct about the default directory?
- If #1 is true then how can I set the default directory to the directory where the main program file is?
- Am I calling the function correctly? (If it can find it of course)
UPDATE
Per Hank's questions below I have added this additional information:
The file "publicfunctions.prg" was added to the project using the "New" button on the Project Manager and the physical file is sitting right next to the "Main.prg" file in the file system folder.
I am using Microsoft Visual FoxPro 9.0
Any and all help will be truly appreciated.
Thanks,
Doug