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 JustStem() function
The VFP JustStem() function returns the stem of a file name, the name with the period and extension removed. It can accept a filename with or without a path:
would return:
The JustStem() function can accept a folder name instead of a filename but it is similar to JustPath() in the way that its behaviour changes depending on whether or not the folder name ends in a backslash.
JustStem() is useful when you are copying files or exporting data. If you are sending data from a table to an Excel file then you can use this function to build the name of an xls file which matches the table name:
*-- then extract its stem.
lcTableName = Dbf()
lcStem = JustStem(lcTableName)
*-- Now build the name of the xls and export the data.
lcXlsName = lcStem + ".xls"
Copy To &lcXlsName Type Xls
This is a simple example which just dumps the xls file into the current folder. A practical example would read the name of the export folder from a table or ask the user where they wanted to store the exported data.
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.