TRY STRTOFILE(.ioDataTransformer.icXMLString, lcTargetFile) CATCH STORE .T. TO llErrorOccurred ENDTRY3) Try using a function to see if you can generically create a file in that directory. If you do not have one, here is one that I use (note: it has not been updated to use TRY/ENDTRY which I prefer to use now). Note that the below may have more options/code in it then you want so rewrite accordingly.
PROCEDURE CanCreateFile * procedure to test if it is possible to create a file in the passed in directory or not; if a file name is also passed, will test * with designated file name; if no file name passed, will work up a temp name and test with that * Written by: Albert Gostick * Last Updated: Mar 3, 2010 * Changes: * Mar 3, 2010: slight change to change name of function TempName() to TempFileName() * Note: below will overwrite the file if it already exists (if it has rights to do so and the directory could be found) so calling * program have to do their own check if the file already exists; it is not up to this procedure to check as it * simply is being asked if a file can be created there of this name * Parameters: * tcDirectory: directory to test against; required * tcFileName: file name to test with (optional); if nothing passed, will work up a temp file name and use that instead * Returns: .T. if file could be created; .F. otherwise LPARAMETERS tcDirectory, tcFileName LOCAL llCreatedOkay, lnTestHandle, lcFullFilePath, lcOldOnError, llErrorOccurred * if no directory passed, cannot test; return .F. IF VARTYPE(tcDirectory) # "C" OR EMPTY(tcDirectory) RETURN .F. ENDIF * check that directory has trailing slash IF RIGHT(tcDirectory,1) # "\" STORE tcDirectory + "\" TO tcDirectory ENDIF * default return value STORE .F. TO llCreatedOkay * if file name not passed, default to character empty for now IF VARTYPE(tcFileName) # "C" STORE "" TO tcFileName ENDIF * if no file name, create one from scratch IF EMPTY(tcFileName) * this procedure can take a file extension as a parameter so pass ".tmp" STORE TempFileName("tmp") TO tcFileName ENDIF * combine the two for our test STORE tcDirectory + tcFileName TO lcFullFilePath * use FCREATE() to test for file creation without triggering an error STORE FCREATE(lcFullFilePath) TO lnTestHandle * if opened, close and erase it and just continue IF lnTestHandle > 0 * to aid the system admin person as to where these files are coming from, insert a small bit of text into the file; this helps * if for some reason the directory has create rights but not delete rights (ie. system person can open file and it gives a clue) FWRITE(lnTestHandle,"Test File; created by function CanCreateFile() in VFP; if " + ; "not erased after test, check that user has erase rights in this directory") * close the file in preparation for erasing it FCLOSE(lnTestHandle) * user will probably have erase rights if they have create rights but just in case, we need to trap that error; not actually going * to do anything with it as we do not really want to do any messaging; system admin person will have to figure out why files are * being left behind and not erased STORE ON("Error") TO lcOldOnError ON ERROR STORE .T. TO llErrorOccurred ERASE (lcFullFilePath) * restore error trapping to previous ON ERROR &lcOldOnError * set our return var STORE .T. TO llCreatedOkay ENDIF RETURN llCreatedOkay>Select New_bills