Launching Microsoft Access via javascript - Will not stay open

D

Denis

I am trying to launch an .mdb file via javascript. I do not need to
do anything but open the application. It is able to open the
application but for some reason it opens and then closes. At first I
thought it may be a permission problem as far as writing the .ldb file
to disk, but I added every single user and gave them write permissions
to the folder and there is still no change.
Has anyone been able to get this to work?

Thanks in advance.

My code;

var AccessApp = new ActiveXObject("Access.Application.10");
AccessApp.Visible = true;
AccessApp.OpenCurrentDatabase("c:\\case\\case.mdb");
 
R

Richard Cornford

PC Datasheet wrote:
<snip>

Please don't top post in comp.lang.javascript
Just curious ----

("c:\\case\\case.mdb")

Why the double backslashes??
<snip>

The backslash is the escape character in a javascript string literal, a
single backslash would serve to escape the character following it, but
would not be part of the resulting string itself. As is normal with
escape characters, to use the character literally it needs to be escaped
itself.

Richard.
 
L

Lyle Fairfield

(e-mail address removed) (Denis) wrote in @posting.google.com:
I am trying to launch an .mdb file via javascript. I do not need to
do anything but open the application. It is able to open the
application but for some reason it opens and then closes. At first I
thought it may be a permission problem as far as writing the .ldb file
to disk, but I added every single user and gave them write permissions
to the folder and there is still no change.
Has anyone been able to get this to work?

Thanks in advance.

My code;

var AccessApp = new ActiveXObject("Access.Application.10");
AccessApp.Visible = true;
AccessApp.OpenCurrentDatabase("c:\\case\\case.mdb");

You've set a reference to the Access App. When the Javascript closes the
reference goes out of scope. Javascript is quite meticulous about garbage
collection. It releases the variable, and the Access application closes.

How to solve?

Well, if you run the code from an html file ... (hta would probably not get
you warnings) ... and leave that file open then your access app should stay
open.
 
M

Michael Harris \(MVP\)

I am trying to launch an .mdb file via javascript. I do not need to
do anything but open the application. It is able to open the
application but for some reason it opens and then closes. At first I
thought it may be a permission problem as far as writing the .ldb file
to disk, but I added every single user and gave them write permissions
to the folder and there is still no change.
Has anyone been able to get this to work?


var AccessApp = new ActiveXObject("Access.Application.10");
AccessApp.Visible = true;
AccessApp.UserControl = true;
AccessApp.OpenCurrentDatabase("c:\\case\\case.mdb");
 
S

Steve van Dongen [MSFT]

Denis,

Just curious ----

("c:\\case\\case.mdb")

Why the double backslashes??

Steve
PC Datasheet

\ is the escape character in JScript strings and regular expressions.
IOW the character that follows the \ is treated as a literal character
and loses any special meaning it has (if any).

Regards,
Steve
 

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

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top