Open Access mdb from JScript

L

Lieven Roelens

Hi all,

I'm trying to open an Access mdb from JScript.
I run the script in the WSH (Windows Scripting Host).
I get the error 7866 that tells me the mdb is missing or
opened exclusively by another user. I'm absolutely sure
the mdb file is referenced correctly and not used by
another user.

What is causing this error? I expected this would be
straight forward.

Thanks for helping me out.

Lieven
 
C

cafe

Ok. I can't comment on line #1, but I assume you've checked that it is
successfully opening Access? Perhaps set objAccess.visible=true & add a
msgbox, alert or whatever to pause there, so you can check that it appears.

As for line #2, that looks fine to me. Remember that opening an Access db
for read/write will result in the creation of an LDB file in the same
directory as the database. If the current user does not have permission to
create that file in that directry, he would probably get this error.

Can the user in question *manually* start Access & open that database?

HTH,
TC
(off for 24 hours now)
 
L

Lieven Roelens

The user can open the database manually. It works fine
within VB too. It just doesn't work within JScript.

Thanks,

Lieven
 
T

TC

Does the <new ActiveXObject('Access.Application')> thing work with other
applications (eg. Word)?

TC
 
L

Lieven Roelens

Yes, it works with 'Excel.Application'.
-----Original Message-----
Does the <new ActiveXObject('Access.Application')> thing work with other
applications (eg. Word)?

TC






.
 
T

TC

Another "last" thing I can think of: try it with some other database. Then
at least you know whether the problem is specific to the database in
question (or not).

HTH,
TC
 
L

Lieven Roelens

I'm trying to open a blank database.
-----Original Message-----
Another "last" thing I can think of: try it with some other database. Then
at least you know whether the problem is specific to the database in
question (or not).

HTH,
TC




.
 
T

TC

Sure, but I mean to try opening some *other* database - blank or otherwise.
If *all* of the databases that you try to open get the same error, you know
that the cause does not lie within the database(s). But if some or all of
the other databases *do* work ok, then the error might be specific to the
database that you have been using so far.

HTH,
TC
 
L

Lieven Roelens

Apparently the '\' is removed from the file path when the
mdb is opened. Replace '\' by '\\' to make it work.
-----Original Message-----
That is the whole issue.
The error message is returned on ANY mdb database.
Did somebody try to open a mdb from JScript?
If so what is particular? Why doesn't it work for me?

My impression is that it has something to do with
security BUT I can't find a solution to it. I might say
Microsoft software is very poor in terms of error
messages related to security. According to me the error
message returned is unrelated to the error. It is absurd
to say the database is opened exclusively by another user.
-----Original Message-----
Sure, but I mean to try opening some *other* database - blank or otherwise.
If *all* of the databases that you try to open get the same error, you know
that the cause does not lie within the database(s). But if some or all of
the other databases *do* work ok, then the error might be specific to the
database that you have been using so far.

HTH,
TC
so
 
T

TC

Good result!!

Thanks for posting the reply. I know this happens in some contents, but I
would never have thought of it here.

TC


Lieven Roelens said:
Apparently the '\' is removed from the file path when the
mdb is opened. Replace '\' by '\\' to make it work.
 

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