[AccessD] Closing an open file

John Skolits askolits at ot.com
Mon Nov 6 13:00:34 CST 2006


Hmmm. No, they really don't need to make any changes. That may work. 
So you're saying, if the file is opened as read only, I Can delete it even
if someone has it open?

It would still be nice though to figure out a way to close it if it's open
anyway.
I think that would make things a bit cleaner.




-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
rusty.hammond at cpiqpc.com
Sent: Monday, November 06, 2006 1:07 PM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Closing an open file

John,

Do they need to make changes to the report?  If not I've solved this issue
by 
by setting the report to read only on the network.

Something like the following:

Function ExportRpt(strRptName as String, strFileAndPath as string)

     If Dir(strFileAndPath) <> "" Then
        SetAttr strFileAndPath, vbNormal
        Kill strFileAndPath
     End If

     DoCmd.OutputTo acOutputReport, strRptName, acFormatXLS, strFileAndPath
     SetAttr strFileAndPath, vbReadOnly
End


HTH,

Rusty


-----Original Message-----
From: John Skolits [mailto:askolits at ot.com]
Sent: Monday, November 06, 2006 11:33 AM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Closing an open file


When running Access, I create reports every night, but inevitably, some user
has opened the file off the network and never closed it. I can't remove it
with KILL.
Any one have code for closing a file that may be open so I can then delete
it?

John


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

**********************************************************************
WARNING: All e-mail sent to and from this address will be received,
scanned or otherwise recorded by the CPI Qualified Plan Consultants, Inc.
corporate e-mail system and is subject to archival, monitoring or review 
by, and/or disclosure to, someone other than the recipient.
**********************************************************************
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list