Lost my exclusive lock...

J

John Keith

I have an autoexec macro that runs the following code to set the titlebar.

Public Function All940bDateCreated() As Date
Dim db As Object
Dim sTitle As String
Set db = OpenDatabase("N:\IT\SHARED\All940bDaily.MDB")
All940bDateCreated = db.TableDefs("All940b").DateCreated
db.Close
Set db = Nothing

Set db = Application.CurrentDb
sTitle = "Student Data as of " & All940bDateCreated
db.Properties("AppTitle") = sTitle
Application.RefreshTitleBar
db.Close
Set db = Nothing
End Function

My data is stored in a table in a database on the network drive.
My front-end is stored on my local machine for which I am the only developer.

I had originally negelcted to put the 2nd db.close statement which I thought
had caused shared access which prevented me from making any design changes.
By copying the database I was able to save the 2nd db.close statement;
however this did not solve the problem. I am still locked out of making
design changes.

Is there an alternate way open currentdb objects that will not cause this
lock-out?

or maybe that code isn't the problem,
Is there a way to tell what other process is really the culprit?
 
M

mcescher

I have an autoexec macro that runs the following code to set the titlebar. 

Public Function All940bDateCreated() As Date
  Dim db As Object
  Dim sTitle As String
  Set db = OpenDatabase("N:\IT\SHARED\All940bDaily.MDB")
  All940bDateCreated = db.TableDefs("All940b").DateCreated
  db.Close
  Set db = Nothing

  Set db = Application.CurrentDb
  sTitle = "Student Data as of " & All940bDateCreated
  db.Properties("AppTitle") = sTitle
  Application.RefreshTitleBar
  db.Close
  Set db = Nothing
End Function

My data is stored in a table in a database on the network drive.  
My front-end is stored on my local machine for which I am the only developer.

I had originally negelcted to put the 2nd db.close statement which I thought
had caused shared access which prevented me from making any design changes..  
By copying the database I was able to save the 2nd db.close statement;
however this did not solve the problem.  I am still locked out of making
design changes.  

Is there an alternate way open currentdb objects that will not cause this
lock-out?

or maybe that code isn't the problem,
Is there a way to tell what other process is really the culprit?

Look at the LDB file with note pad, if there are other machine names,
ask those people to get off. Other wise, when you're not in the db,
delete the LDB file.

HTH,
Chris M.
 
J

John Keith

Interesting, I didn't know that you could browse the LDB file to show users,
Nice trick!

Tried running the code to set the title again and I still am being locked
out by 2 instances of the same database being assigned, both have my
footprint in the LDB file.

What is the way to code this so that the title can be set with out causing
the shared access that locks out further development?

For now I am leaving the database title set to the default.
 

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