Solved

Close a file

Posted on 2006-11-07
10
165 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel Vlookup to move data back to source. 4 90
Windows 10 start screen issues 9 54
using Access 8 68
message box in access 4 46
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

776 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