Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to 'Release' a Directory 1

Status
Not open for further replies.

dRahme

Technical User
Jun 24, 2004
286
US
Hello, I have a small procedure that checks for the existance of a drive and directory:

Dim objfso As New FileSystemObject
If objfso.DriveExists("s:") Then
If Dir("s:\Warranty\", vbDirectory) = "" Then

Me.lblSdrive.Caption = "No Warranty Directory Installed on S Drive"
Me.cmdCreateWarrantyS.Visible = True

Else
Me.lblSdrive.Caption = "Warranty Directory is Installed on S Drive"

End If
Else
Me.lblSdrive.Caption = "No 'S' Drive Found."

End If

If I back out try to delete this directory manually, I recieve an error that says the file is in use and cannot be deleted.

If I terminate the Access application I can delete the directory.

How do I 'Release' the directory so that it can be deleted?

I thought it might be akin to

set objfso = nothing

but that is not quite it.

Thanks, dRahme

 
You do need a 'Set objfso = Nothing'. But that will not release the directory. Point the function DIR to somewhere else like Dir("C").Then delete the directory.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top