Creating and Deleteing Access DataBase

From: Dennis (Dennis_at_discussions.microsoft.com)
Date: 03/18/05


Date: Thu, 17 Mar 2005 16:57:04 -0800

In VB.Net, I create a database file using ADOX Catalog. However, I want to
later delete the file but I get an error message that the database is being
used by
another process. I have even tried creating the database then deleting it
immediately after with no other manipulations of creating tables, etc. It
seems that the ADOX catalog create method does not release the file. I've
even tried setting it to nothing but still it holds it in it's process. How
do I release the file?

Dim catNewDB As New ADOX.Catalog
Dim fi As New IO.FileInfo(DBName)
Try
   If fi.Exists Then
        fi.Delete()
   End If
   catNewDB.Create("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DBName)
   catNewDB = Nothing
catch
end try
dim fi as new IO.FileInfo(DBName)
fi.Delete 'get error here saying that another process using the file.

-- 
Dennis in Houston


Relevant Pages

  • re: Cannot query Access db on server
    ... put your database in a subfolder named ... and make that folder ... > dim sLName ... >I've searched for this error message in the Knowledge ...
    (microsoft.public.frontpage.programming)
  • Re: Lost in For Each loop
    ... I get an error message say database is not a defined ... datatype when I type "Dim db as Database". ... >usually works well to loop through fields in a recordset, ...
    (microsoft.public.access.modulesdaovba)
  • Re: Insert record code
    ... When you say old database and new database, ... Are you getting an error message. ... Dim intNewRecRepairNumber As Integer ...
    (microsoft.public.vb.general.discussion)
  • error 3167 "record deleted"
    ... The database is access 2000 and visual basic makes an ... connection to the database with DAO 3.60. ... Now one of the users gets twice an error message, ... Dim dbs As DAO.Database ...
    (microsoft.public.vb.database.dao)
  • Re: error 3167 "record deleted"
    ... The database is access 2000 and visual basic makes an ... connection to the database with DAO 3.60. ... Now one of the users gets twice an error message, ... Dim dbs As DAO.Database ...
    (microsoft.public.vb.database.dao)