Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Software > Access Table db Design > Linked Tables -...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 12 Topic 12085 of 12657
Post > Topic >>

Linked Tables - How to Close External Database?

by newsgroups@[EMAIL PROTECTED] Aug 4, 2008 at 11:10 PM

I have a re****t that within the Re****t_Open event, I create a
tem****ary database and create a linked table to it (using the code
fragment below).

    Dim tdfNew As TableDef
    Dim RS As Recordset
    Dim wrkDefault As Workspace
    Dim dbsTemp As Database

    Dim strTableName As String

    ' Get default Workspace.
    Set wrkDefault = DBEngine.Workspaces(0)

    ' Make sure there isn't already a file with the name of the new
database.
    If Dir(mstrTempDatabase) <> "" Then Kill mstrTempDatabase

    'Create a new temp database
    Set dbsTemp = wrkDefault.CreateDatabase(mstrTempDatabase,
dbLangGeneral)

    ' Delete the link to the temp table if it exists
    If TableExists(mstrTableName) Then CurrentDb.TableDefs.Delete
mstrTableName

    ' Create the temp table
    Set tdfNew = dbsTemp.CreateTableDef(mstrTableName)
    With tdfNew
        .Fields.Append .CreateField("Resource Name", dbText)
        .Fields.Append .CreateField("Profile", dbMemo)
        dbsTemp.TableDefs.Append tdfNew
    End With

    dbsTemp.TableDefs.Refresh

    ' Link to the Im****t tables in the temp MDB
    Dim tdfLinked As TableDef
    Set tdfLinked = CurrentDb.CreateTableDef(mstrTableName)
    tdfLinked.Connect = ";DATABASE=" & mstrTempDatabase
    tdfLinked.SourceTableName = mstrTableName
    CurrentDb.TableDefs.Append tdfLinked

    CurrentDb.TableDefs.Refresh

    RefreshDatabaseWindow


Now the problem. I can delete the linked table, but the other
tem****ary database is still open and I cannot delete it. It is
released about 5-10 seconds after the re****t has been closed.

Can someone help me on forcing a close on this re****t so I can delete
the tem****ary file.

Thanks in advance.
 




 12 Posts in Topic:
Linked Tables - How to Close External Database?
newsgroups@[EMAIL PROTECT  2008-08-04 23:10:21 
RE: Linked Tables - How to Close External Database?
=?Utf-8?B?SmltIEJ1cmtlIGl  2008-08-05 07:00:01 
RE: Linked Tables - How to Close External Database?
=?Utf-8?B?S2xhdHV1?= <  2008-08-05 08:11:00 
Re: Linked Tables - How to Close External Database?
bandwood1@[EMAIL PROTECTE  2008-08-05 18:57:51 
Re: Linked Tables - How to Close External Database?
=?Utf-8?B?S2xhdHV1?= <  2008-08-06 06:34:01 
Re: Linked Tables - How to Close External Database?
Marshall Barton <marsh  2008-08-06 13:05:58 
Re: Linked Tables - How to Close External Database?
"david" <dav  2008-08-11 17:10:34 
Re: Linked Tables - How to Close External Database?
bandwood1@[EMAIL PROTECTE  2008-08-05 18:58:23 
Re: Linked Tables - How to Close External Database?
bandwood1@[EMAIL PROTECTE  2008-08-06 17:39:07 
Re: Linked Tables - How to Close External Database?
Marshall Barton <marsh  2008-08-07 12:34:50 
Re: Linked Tables - How to Close External Database?
bandwood1@[EMAIL PROTECTE  2008-08-06 17:52:59 
Re: Linked Tables - How to Close External Database?
"david" <dav  2008-08-11 15:33:18 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Dec 1 13:21:48 CST 2008.