Launching Microsoft Access via javascript - Will not stay open

Discussion in 'Javascript' started by Denis, Apr 15, 2004.

  1. Denis

    Denis Guest

    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");
     
    Denis, Apr 15, 2004
    #1
    1. Advertisements

  2. PC Datasheet wrote:
    <snip>

    Please don't top post in comp.lang.javascript
    <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.
     
    Richard Cornford, Apr 15, 2004
    #2
    1. Advertisements

  3. (Denis) wrote in @posting.google.com:
    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.
     
    Lyle Fairfield, Apr 15, 2004
    #3
  4. I am trying to launch an .mdb file via javascript. I do not need to

    var AccessApp = new ActiveXObject("Access.Application.10");
    AccessApp.Visible = true;
    AccessApp.UserControl = true;
    AccessApp.OpenCurrentDatabase("c:\\case\\case.mdb");
     
    Michael Harris \(MVP\), Apr 16, 2004
    #4
    britnysarver92 likes this.
  5. \ 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
     
    Steve van Dongen [MSFT], Apr 16, 2004
    #5
  6. Excellent. I didn't know about this property.
     
    Lyle Fairfield, Apr 16, 2004
    #6
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.