Database development and training for Birmingham and the midlands
Specialists in Microsoft Access and Visual Foxpro database training and development
I am happy to hear from existing clients but I am taking no new calls.
FoxPro AddBS() function
The VFP AddBS() function adds a final backslash to a path if it does not already end in a backslash. For example:
would return the path with a final backslash:
but if the path being passed in already ends in a backslash:
then the function would not add another backslash but would return:
Note that you can pass a path with forward slashes into AddBS() but the function will always add a backslash, even if the path already ends with a forward slash.
AddBS() will not add a backslash to an empty string.
AddBS() is particularly useful when you are processing pathnames or assembling a path from a number of separate components. If you use the GetDir() function to let the user select a folder from the directory tree then you will always get the path with a final backslash. If you are using another technique to enter paths or if you are importing the paths from another application then AddBS() lets you add a consistent backslash to these values and avoid errors when you try to assemble a pathname and file without backslashes.
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.