John Skolits
askolits at ot.com
Fri Sep 1 09:23:53 CDT 2006
I use both methods with good success so not sure if there are any gotchas. -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin - Beach Access Software Sent: Friday, September 01, 2006 9:58 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] File Copy John: Unbound form. I would guess that there's something going on in my form that's not releasing the file number. I know I get this error if I try to open a file with a file number that's already in use. But with FileCopy there's no file number. For the moment I kind of went around the problem by using: Dim fs As Object Set fs = CreateObject("Scripting.FileSystemObject") fs.copyfile strExportPath & "Cressona Template.xls", Me.txtOutputFileName and that seems to work. Are there any known gotchas with file scripting? The FileCopy seemed so much mo' simpler. Thanks and Regards, Rocky John Skolits wrote: > Rocky, > > I tried this by creating an 'unbound' form and ran it multiple times and it > just kept overwriting the file with no problem. Was your form bound? > The various output files names I placed in the text box 'txtOutputFileName' > were: > "c:\test.xls" > "c:\test 2.xls" > "test.xls" > "test 2.xls" > Since you didn't specify a path, I tried it with and without one. > > When no path was specified, it obviously used the default. 'MyDocuments' > > John > > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin - > Beach Access Software > Sent: Thursday, August 31, 2006 7:47 PM > To: Access Developers discussion and problem solving > Subject: [AccessD] File Copy > > Dear List: > > When I run a chunk of code which includes: > > FileCopy "Cressona Template.xls", Me.txtOutputFileName > > it runs fine. If I run it again, however, without closing the form and > reopening it (but deleting the target file specified in > Me.txtOutputFileName that was created the first time), I get an error > 52 - bad file number. > > Does anyone know why? > > MTIA, > > Rocky > > -- Rocky Smolin Beach Access Software 858-259-4334 www.e-z-mrp.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com