[AccessD] Closing an open file

rusty.hammond at cpiqpc.com rusty.hammond at cpiqpc.com
Mon Nov 6 13:20:45 CST 2006


Yes, at least for an excel file anyway. I'm assuming ms word works the same
way.   When the file is read only, a copy gets loaded into excel without the
file being held open.  It also helps avoid the issue of someone making
changes to the report accidentally.  If they want to save changes, they can
to another filename but the master remains intact.

I agree the ability to close an open file would be nice, but for this
situation the read-only setting works great.



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


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


-- 
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.
**********************************************************************



More information about the AccessD mailing list