Microsoft Developer Network > Forenhomepage > Visual Basic for Applications (VBA) > Open an access vba function in a form using javascript
Stellen Sie eine FrageStellen Sie eine Frage
 

BeantwortetOpen an access vba function in a form using javascript

  • Freitag, 10. Juli 2009 23:23Condor10101010101 TeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillen
     
    Hi,

    I have created an access vba function which I now want the ability to call from a SharePoint page via JavaScript.  Here's what I have thus far:

    function test() {
    var App = new ActiveXObject("Access.Application")
    App.Visible = true;
    App.OpenCurrentDatabase("fullPath");
    App.Run("Module1!test")
    }
    The Module's name is Module1 and the function is called test.  It appears that everything works OK until line:

    App.Visible = true;
    
    
    
    
    Then the problem occurs in the next line:

    App.OpenCurrentDatabase("fullPath");
    
    
    
    
    Has someone tackled this before?  Thank you!


    BTW,  I'm calling the function from a SharePoint page as follows:

    <div>
    	<form>
    		<input type="button" value="Click me!" onclick="test()" />
    	</form>
    </div>
    
    
    
    
    
    
    
    

Antworten

  • Sonntag, 12. Juli 2009 07:45BrijrajRathod TeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillen
     Beantwortet
    Hello,

    use below test function in your code. and please go through comments. Thanks.

    function test()
    {
            var App = new ActiveXObject("Access.Application")       
            //use double \\ for path, if required.
            var fullPath="C:\\work Station\\Access Group\\Open Access Using Java Script\\OpenAccessUsingJavaScript.mdb";  
            //first open data base then set property of visible to true.
            App.OpenCurrentDatabase(fullPath);
            App.Visible = true;
            App.Run("test"); // i am calling test procedure, which is public in module, no need to apply module name to call it.
    }
    Rgrds, Brij http://accessvbadeveloper.wordpress.com

Alle Antworten

  • Sonntag, 12. Juli 2009 07:45BrijrajRathod TeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillen
     Beantwortet
    Hello,

    use below test function in your code. and please go through comments. Thanks.

    function test()
    {
            var App = new ActiveXObject("Access.Application")       
            //use double \\ for path, if required.
            var fullPath="C:\\work Station\\Access Group\\Open Access Using Java Script\\OpenAccessUsingJavaScript.mdb";  
            //first open data base then set property of visible to true.
            App.OpenCurrentDatabase(fullPath);
            App.Visible = true;
            App.Run("test"); // i am calling test procedure, which is public in module, no need to apply module name to call it.
    }
    Rgrds, Brij http://accessvbadeveloper.wordpress.com
  • Montag, 13. Juli 2009 17:20Condor10101010101 TeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillen
     
    Thank you VBA - Developer!  Adding the extra slash to my path did the trick!  Appreciate your help!