Loosing exclusive rights with DAO code

G

Guest

after executing this:

Dim db As Database
Dim dbExt As Database

Set db = CurrentDb()
Set dbExt = OpenDatabase("C:\backend.mdb")

db.Close
dbExt.Close

Access says the current db is no longer opened in exclusive mode.

Is that a bug ?
 
M

Marshall Barton

Henry said:
after executing this:

Dim db As Database
Dim dbExt As Database

Set db = CurrentDb()
Set dbExt = OpenDatabase("C:\backend.mdb")

db.Close
dbExt.Close

Access says the current db is no longer opened in exclusive mode.

Is that a bug ?


I don't know, never seen that before.

However, technically, since you did not open CurrrentDb, you
should not try to close CurrentDb. We have been assured(?)
that it doesn't do anything, but ...

OTOH, it may(?) be important to set the object variables to
Nothing.

I seriously doubt it will solve your problem, but the
recommended code is:
Set db = Nothing
dbExt.Close : Set dbExt = Nothing
 
G

Guest

yes, I need to drink more coffee too ;-)

Marshall Barton said:
I don't know, never seen that before.

However, technically, since you did not open CurrrentDb, you
should not try to close CurrentDb. We have been assured(?)
that it doesn't do anything, but ...

OTOH, it may(?) be important to set the object variables to
Nothing.

I seriously doubt it will solve your problem, but the
recommended code is:
Set db = Nothing
dbExt.Close : Set dbExt = Nothing
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top