Back up backend file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I "borrowed" a subroutine that I found in this group to create a backup of my
backend. (Thanks Ken Snell). Before it runs a backup it checks for a locking
file to make sure that no one else is in the system. This works fine if I
manually close any open forms before I try to run the subroutine. But if I
close forms in vba as part of my function it leaves the locking file and
'believes' someone else is in the system. Can someone tell me how to get rid
of the .ldb file.
 
How are you closing the forms? It shouldn't matter whether you're closing
them programmatically or manually.
 
I expect there's probably a better way but I've never needed to ge
rid of the ldb file in VBA before - if no one else suggests anythin
you could use the 'kill' method to delete it
 
I initially was just closing the form I expected to be active. I then
realized I should make sure all are closed, so I created:

Public Function ClsForms()
Dim i As Integer
For i = Forms.Count - 1 To 0 Step -1
DoCmd.Close acForm, Forms(i).Name
Next
Connection.Close
End Function

If I watch the directory that the ldb file is in as I manually close forms,
I see it disappear. When I use code to close, it's still there.
 
Oops,
I just noticed that the code I sent isn't what I'm using.
that line
"connection.close"
Is just something I stuck in to show what I think is missing - I forgot to
delete it before I sent the code - also, I was having the exact same result
when I was just closing the one form.
 
That should work: that's essentially what I use successfully in my
applications.
 
Is there some action I should take to "close the connections"? If so, how
would I do that? (If it isn't clear, I am NOT a programmer)
 
You shouldn't require anything more than you have.

You don't have a report or query open when you're doing this by any chance?
 
I finally "solved" the problem by putting the button onto a form instead of
the toolbar - but I don't understand why I can't get it to work from the
toolbar
 
I can't be sure since I haven't done any checking but I'd assume tha
the code for the button resides within the database - even if th
button is on the toolbar

So when you close the database but the button is still there then i
still has to access the code from the database thus the ldb fil
remains - in the case of a form button when the form is closed so i
the button and so the code is no longer required and the ldb file ca
be removed

That's my theory anyway :
 
Back
Top