Solved

Close a file

Posted on 2006-11-07
10
166 Views
Last Modified: 2010-04-30
If someone has a file open (either .txt, .mdb, etc...) in Win XP Pro over a network, it cannot be deleted because someone is tying it up.  How can I "terminate" this connection in order to be able to delete/rename the file?

This question is a  ** RUSH ** request.

Thank you,
Mike
0
Comment
Question by:CCIG2006
10 Comments
 
LVL 65

Expert Comment

by:Jim Horn
ID: 17890296
There is no way that I know of to terimante a network connection with *any* file.

For Access apps, you can create custom programming to kick out users on a networked app.
0
 
LVL 11

Accepted Solution

by:
Dany Balian earned 500 total points
ID: 17890836
'here's what u should do
'here's the vbs script

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "NET SESSION /DELETE /y" 'run batch file, Use your absolute path here
SET WSHSHELL=nothing

'i tried it, it works...
 hope this is what u want...

cheers,

dan
0
 
LVL 4

Expert Comment

by:JRCSystems
ID: 17894678
I think MrDany solution will work... looks like it.
I would only question why involve Windows Scripting Shell.
The same command can be run directly from the built-in vb Shell command.
Dim plResult as Long

plResult = Shell("CMD.EXE /C NET SESSION /DELETE /Y", vbNoFocus)
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 11

Expert Comment

by:Dany Balian
ID: 17895875
Hey jrcsystems,

thanks for pointing out to the shell command.

but the script that i gave was a vbs script cos i wasnt sure if Mike wanted a script for vb6 or vbs..

my solution works in both vb6 and vbs while the shell command is available only in vb6...

cheers,

Dan
0
 
LVL 4

Expert Comment

by:JRCSystems
ID: 17897551
Dan,

No problem. There is a place for scripting. I work almost exclusively in VB6 apps. Been in VBx for years.

I simply try to avoid scripting where possible because for Apps that are distributed outside the company,
(where you don't have control of sending out memos, telling collegues what to do)
too many anti-virus programs will raise a flag saying your App is trying to run a malicious script.
(even though it doesn't have a clue exactly what you are attempting).

John
 
0
 

Author Comment

by:CCIG2006
ID: 18381601
My wife has recently passed away and I am trying to take care of things.  I have not had time to review the answers, so I ask that you please allow more time.

Your cooperation is greatly appreciated.

Thank you,
Mike
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question