Error opening Database from VB6

J

JamesW

When I try to open an Access 2000 database using the
following VB 6 script I get the error 7866 Microsoft
Access can't open the database because it is missing, or
exclusively locked by another user. I have checked and
the database is where the link says and was not being used
by another user.

Private Sub Command11_Click()
Dim X As Object
Set X = CreateObject("access.application")
X.Visible = True
X.OpenCurrentDatabase
"\\admin\compsect\data\databases\inventory\inventory.mbd"
Set X = Nothing
End Sub

Any help would be appreciated.
 
J

JamesW

Sorry that was a typo when doing the message. I have
got the database opening but it immedaitely closes again.
How do I get it to stay open.
 
V

Van T. Dinh

Something in your VB program closes it, I think.

I used your code in an A2K2 instance to open a 2nd Access instance and
another database and it worked fine.

--
HTH
Van T. Dinh
MVP (Access)
 
W

What-a-Tool

I had the same problem and couldn't figure out why. Went crazy with it.
Finally moved my DB to another directory that wasnt buried quite so deep
(Moved it within the first tier of my directory tree). Now it works fine.
Was a weird problem and I don't know why it was reacting this way.(I know my
path was correct)

--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
 

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