By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,107 Members | 1,323 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,107 IT Pros & Developers. It's quick & easy.

Why can't I Kill temporary database?

P: n/a
I've begun using the technique of putting temporary tables in a temporary
database in my C:\Temp folder. Everything is fine except I can't kill the
database when exiting Access. I get a "Permission Denied", even if I just
open and then close the main database without creating any temporary tables.

Why, oh why?

Thanks,
Krisa
Nov 12 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Does it have an .ldb?

"Krisa" <Kr*************@comcast.net> wrote in message
news:ve********************@comcast.com...
I've begun using the technique of putting temporary tables in a temporary
database in my C:\Temp folder. Everything is fine except I can't kill the
database when exiting Access. I get a "Permission Denied", even if I just
open and then close the main database without creating any temporary tables.
Why, oh why?

Thanks,
Krisa

Nov 12 '05 #2

P: n/a
Nope

- Krisa

"Mark B" <remove_from _h*********************@ihug.co.nz> wrote in message
news:bl**********@lust.ihug.co.nz...
Does it have an .ldb?

"Krisa" <Kr*************@comcast.net> wrote in message
news:ve********************@comcast.com...
I've begun using the technique of putting temporary tables in a temporary database in my C:\Temp folder. Everything is fine except I can't kill the database when exiting Access. I get a "Permission Denied", even if I just open and then close the main database without creating any temporary

tables.

Why, oh why?

Thanks,
Krisa


Nov 12 '05 #3

P: n/a
I should have added: it has no trouble killing the temporary database when
I first open the main database. Code for this part is straight from Tony
Toew's sample mdb:
'------------------
Dim wrkDefault As Workspace
Dim strTempDatabase As String
strTempDatabase = fTempDatabaseName

' 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(strTempDatabase) <> "" Then Kill strTempDatabase
etc....
'----------------

But following line, in close event of hidden form that closes when you exit
database, doesn't:

Kill strTempDatabase
Aaarrrgggh!

Krisa
"Mark B" <remove_from _h*********************@ihug.co.nz> wrote in message
news:bl**********@lust.ihug.co.nz...
Does it have an .ldb?

"Krisa" <Kr*************@comcast.net> wrote in message
news:ve********************@comcast.com...
I've begun using the technique of putting temporary tables in a temporary database in my C:\Temp folder. Everything is fine except I can't kill the database when exiting Access. I get a "Permission Denied", even if I just open and then close the main database without creating any temporary

tables.

Why, oh why?

Thanks,
Krisa


Nov 12 '05 #4

P: n/a
On Wed, 1 Oct 2003 20:21:03 -0400 in comp.databases.ms-access, "Krisa"
<Kr*************@comcast.net> wrote:
I should have added: it has no trouble killing the temporary database when
I first open the main database. Code for this part is straight from Tony
Toew's sample mdb:
'------------------
Dim wrkDefault As Workspace
Dim strTempDatabase As String
strTempDatabase = fTempDatabaseName

' 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(strTempDatabase) <> "" Then Kill strTempDatabase
etc....
'----------------

But following line, in close event of hidden form that closes when you exit
database, doesn't:

Kill strTempDatabase


Have you closed the temp database and set that variable to nothing by
then?

--
A)bort, R)etry, I)nfluence with large hammer.
Nov 12 '05 #5

P: n/a
Duh! Thank you, Trevor.

As info, I added the following to the module containing the temporary
database code, and called it from the close event of my "Persistent
Connection" form:

Public Sub KillTempDatabase()
Dim strTempDatabase As String
strTempDatabase = fTempDatabaseName 'Function to determine name
of temporary database
Set dbstemp = Nothing ' Variable
dimmed in declarations section of module.
Kill strTempDatabase
End Sub
Tony's sample "creates and destroys" the temporary database all in the same
procedure. I had to change it somewhat because I need to keep the tables
and database around for a while so I could use/reuse them in various places.
Had commented out the "Nothing" and "Kill" parts of Tony's code to
accomplish this, then forgot I needed them again when exiting.

Again, thank you, Trevor.

Regards,
Krisa

"Trevor Best" <bouncer@localhost> wrote in message
news:i7********************************@4ax.com...
On Wed, 1 Oct 2003 20:21:03 -0400 in comp.databases.ms-access, "Krisa"
<Kr*************@comcast.net> wrote:
I should have added: it has no trouble killing the temporary database whenI first open the main database. Code for this part is straight from Tony
Toew's sample mdb:
'------------------
Dim wrkDefault As Workspace
Dim strTempDatabase As String
strTempDatabase = fTempDatabaseName

' 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(strTempDatabase) <> "" Then Kill strTempDatabase
etc....
'----------------

But following line, in close event of hidden form that closes when you exitdatabase, doesn't:

Kill strTempDatabase


Have you closed the temp database and set that variable to nothing by
then?

--
A)bort, R)etry, I)nfluence with large hammer.

Nov 12 '05 #6

P: n/a
"Krisa" <Kr*************@comcast.net> wrote:
Tony's sample "creates and destroys" the temporary database all in the same
procedure. I had to change it somewhat because I need to keep the tables
and database around for a while so I could use/reuse them in various places.
Had commented out the "Nothing" and "Kill" parts of Tony's code to
accomplish this, then forgot I needed them again when exiting.


Yeah, I should really split that into two modules to make it much more clear what can
be done.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Nov 12 '05 #7

P: n/a
Actually, I had to do split the module into a lot more pieces to implement
it. I developed my own sample database, building off of Tony's, that
demonstrates how to work with the temp tables outside of the module. It
contains a form with buttons that switch the form's RecordSource between a
permanent table and a temporary table. It took me a while to figure all
this out, so I wanted to keep a succint example somewhere that I could
readily use in "real" databases.

I'd be happy to share the sample database with anyone who's interested (and
promises not to laugh at some of my clumsy coding). It contains other code
and tricks I've also gleaned from this newsgroup, so is certainly not my
creation alone.

Regards to all, especially Tony and Trevor.

Krisa
(change "FakeDomain" to "comcast" to email me: ga*****@FakeDomain.net)
"Tony Toews" <tt****@telusplanet.net> wrote in message
news:5d********************************@4ax.com...
"Krisa" <Kr*************@comcast.net> wrote:
Tony's sample "creates and destroys" the temporary database all in the sameprocedure. I had to change it somewhat because I need to keep the tables
and database around for a while so I could use/reuse them in various places.Had commented out the "Nothing" and "Kill" parts of Tony's code to
accomplish this, then forgot I needed them again when exiting.
Yeah, I should really split that into two modules to make it much more

clear what can be done.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm

Nov 12 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.