FoxPro ForcePath function

The VFP ForcePath() returns the filename with the specified path replacing any existing path.

For example:

ForcePath ("C:\Microsoft Visual FoxPro 9\vfp9.exe", "D:\")

would return


This function is useful when you want to make a backup of a file in a new folder. You can use the GetDir fuction to ask the user for a new path then use ForcePath to add this to the file names that you want to copy.

Note that FoxPro will not check whether the path specified exists or even if it is a correctly formed path name.

VBA equivalent

Microsoft Access does not have equivalents to these FoxPro file name commands so I wrote this library Visual Basic functions to do give me the same facilities in VBA.