> As per my previous post, I think that rocco's
> most likely problem is that the folder he's trying
> to create the text file in doesn't already exist. Your
> coding, whilst elegant, would throw the same error.
The Open for Append statement creates a file, if the specified file does not
already exits. I believe you will find that explained in Help on the Open
statement, in most versions of Access, at least back to and including,
Access 2.0. It also does not depend on the FileSystemObject, which is often
deleted and blocked by System Administrators for security.
And, in your pevious post, you stated that the "FileSystemObject is used
extensively by VBA" which is in error. FSO can be used _from_ VBA, but it is
not used _by_ VBA. If it were, that would imply that FSO was required to run
VBA, and as stated above, SYSADMINS often remove it from systems under their
control, and block its reinstallation -- and VBA runs just fine on those
systems without FSO.
Larry Linson
Microsoft Access MVP
BeWyched - 28 May 2007 10:56 GMT
Hi Larry
If you had read my post more carefully you would note that I said that 'most
likely problem is that the folder he's trying to create the text file in
doesn't already exist'. I am fully aware that the file would be created (as
clearly mentioned in the Help files), but the Method won't create a folder if
it doesn't exist (no mention in the Help files and it does throw an error on
my PC - Access 2003). I therefore stand by my suggestion that rocco should
test for the existence of the folder and create it if necessary.
Re FileSystemObject - I don't think differentiating between _from_ and _by_
serves any useful purpose. All I know is that I have created, and seen many
other applications, that have used FSO succesfully from/by/within VBA.
BW
> > As per my previous post, I think that rocco's
> > most likely problem is that the folder he's trying
[quoted text clipped - 16 lines]
> Larry Linson
> Microsoft Access MVP