Check code is running: Access/VBA from ASP

Ask a Question related to ASP, Design and Development.

  1. #1

    Default Check code is running: Access/VBA from ASP

    Hi Guys

    I am using this code to execute an Access VBA function from ASP:

    strDbName = strDataSource & "data\webjobs.mdb"
    Set objAccess = Server.CreateObject("Access.Application")
    objAccess.Visible = False
    objAccess.OpenCurrentDatabase strDbName
    objAccess.Run "ASP_SkillSearch", strTable, oUpload.Form("firstname"),
    oUpload.Form("surname")

    I have a few issues that i need to solve, any help would be greatly
    appreciated:

    1/ This code takes around 2+mins to run, so I would like the code to run and
    for the webpage to be released immediately, so that they do not have to wait
    for the code.

    2/ I would like to do a similar thing that i do in VB6 (i am new to ASP)
    which i would use this code for:
    on error resume next
    Set objAccess = Server.GetObject("Access.Application")
    If err = True then
    Set objAccess =
    Server.CreateObject("Access.Application")
    End if
    Is it possible to check if a version of access is running, like above?

    3/ I would like to check if the function within access that i am attempting
    to execute is running already.

    Sorry about the list of problems,

    As i said before any help would be greatly appreciated.

    Thanks Si


    Si Guest

  2. Similar Questions and Discussions

    1. Running a CF 5 code on CF MX (compatibility)
      Hello everyone. I am new to ColdFusion - currently updated from CF5 to CFMX, and I have a problem running a script written for CF5 at CFMX. (i...
    2. Ways to check the status of a long-running transaction
      I recall this being discussed before, but I couldn't manage to find it in the archives. Is there any way to see how many rows a running...
    3. Running Preflight Check Programmatically From VB
      I have found things like the AVExpT.h header file and AVCommandPreflightFileProc which are written in C++, but what about VB? How can you...
    4. check a running process, impersonate
      I found that I could start a process from an aspnet page, but not check to see if it was running! I found a splendid little article that seemed...
    5. problem running code...
      Hi! I have a problem running my code on 2000 server and iis5.0. The code runs perfectly on my localhost (xp iis5.1) but when i run it on 2000...
  3. #2

    Default Re: Check code is running: Access/VBA from ASP

    Actually i have solved No Three, but any help with the rest would be great!!

    Thanks Si

    "Si" <nospam@nospam.com> wrote in message
    news:uNZEOxHmDHA.2772@TK2MSFTNGP10.phx.gbl...
    > Hi Guys
    >
    > I am using this code to execute an Access VBA function from ASP:
    >
    > strDbName = strDataSource & "data\webjobs.mdb"
    > Set objAccess = Server.CreateObject("Access.Application")
    > objAccess.Visible = False
    > objAccess.OpenCurrentDatabase strDbName
    > objAccess.Run "ASP_SkillSearch", strTable, oUpload.Form("firstname"),
    > oUpload.Form("surname")
    >
    > I have a few issues that i need to solve, any help would be greatly
    > appreciated:
    >
    > 1/ This code takes around 2+mins to run, so I would like the code to run
    and
    > for the webpage to be released immediately, so that they do not have to
    wait
    > for the code.
    >
    > 2/ I would like to do a similar thing that i do in VB6 (i am new to ASP)
    > which i would use this code for:
    > on error resume next
    > Set objAccess = Server.GetObject("Access.Application")
    > If err = True then
    > Set objAccess =
    > Server.CreateObject("Access.Application")
    > End if
    > Is it possible to check if a version of access is running, like above?
    >
    > 3/ I would like to check if the function within access that i am
    attempting
    > to execute is running already.
    >
    > Sorry about the list of problems,
    >
    > As i said before any help would be greatly appreciated.
    >
    > Thanks Si
    >
    >

    Si Guest

  4. #3

    Default Re: Check code is running: Access/VBA from ASP

    Si wrote:
    > Hi Guys
    >
    > I am using this code to execute an Access VBA function from ASP:
    >
    > strDbName = strDataSource & "data\webjobs.mdb"
    > Set objAccess = Server.CreateObject("Access.Application")
    > objAccess.Visible = False
    > objAccess.OpenCurrentDatabase strDbName
    > objAccess.Run "ASP_SkillSearch", strTable, oUpload.Form("firstname"),
    > oUpload.Form("surname")
    What is oUpload?
    >
    > I have a few issues that i need to solve, any help would be greatly
    > appreciated:
    >
    > 1/ This code takes around 2+mins to run, so I would like the code to
    > run and for the webpage to be released immediately, so that they do
    > not have to wait for the code.
    Access does not support asynchronous execution, so it cannot be done this
    way. You should find another way to run this code. For one thing: it is not
    a good idea to automate Access (or any Office app) from ASP code. There will
    be no one sitting at the server to respond to errors.

    Is it possible to convert the VBA code to a vbscript function that can be
    run in an ASP page? If so, you can use the XMLHTTPRequest object from
    client-side code to asynchronously call the page. For details, please post
    to a client-side code newsgroup devoted to whichever language you are using
    in your client-side code. Look for newsgroups with "dhtml" in their name.
    m.p.scripting.* will also do.

    If you need to do this in server-side code, you can use the ServerXMLHTTP
    object, like this:

    <%
    url = "RunSkillSearch.ASP"
    set xmlhttp = server.CreateObject("MSXML2.ServerXMLHTTP")
    xmlhttp.open "GET", url, true
    xmlhttp.send ""
    set xmlhttp = nothing
    %>

    If you need to pass parameters do this instead:
    url = "RunSkillSearch.ASP?firstname=" & _
    oUpload.Form("firstname") & "&surname=" & _
    oUpload.Form("surname")

    >
    > 2/ I would like to do a similar thing that i do in VB6 (i am new to
    > ASP) which i would use this code for:
    > on error resume next
    > Set objAccess =
    > Server.GetObject("Access.Application") If err =
    > True then Set objAccess =
    > Server.CreateObject("Access.Application")
    > End if
    > Is it possible to check if a version of access is running, like above?
    Yes. On Error Resume Next works in vbscript.

    HTH,
    Bob Barrows

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"


    Bob Barrows Guest

  5. #4

    Default Re: Check code is running: Access/VBA from ASP

    Hi Bob

    oUpload, is a part of ASPUpload, which is what my predecessor used to upload
    a Word doc to our webserver.

    I dont think i explained qu1 too well: I wish to execute the function in
    access and then release the ASP page from access. Then the server can busy
    itself running the code, which only modifies data in the background and the
    user can continue looking through the website.

    I dont fancy turning the code into VBScript as it will take much longer to
    run.

    Thanks Si


    "Bob Barrows" <reb01501@NOyahoo.SPAMcom> wrote in message
    news:%23TwoF6ImDHA.988@TK2MSFTNGP10.phx.gbl...
    > Si wrote:
    > > Hi Guys
    > >
    > > I am using this code to execute an Access VBA function from ASP:
    > >
    > > strDbName = strDataSource & "data\webjobs.mdb"
    > > Set objAccess = Server.CreateObject("Access.Application")
    > > objAccess.Visible = False
    > > objAccess.OpenCurrentDatabase strDbName
    > > objAccess.Run "ASP_SkillSearch", strTable, oUpload.Form("firstname"),
    > > oUpload.Form("surname")
    >
    > What is oUpload?
    >
    > >
    > > I have a few issues that i need to solve, any help would be greatly
    > > appreciated:
    > >
    > > 1/ This code takes around 2+mins to run, so I would like the code to
    > > run and for the webpage to be released immediately, so that they do
    > > not have to wait for the code.
    >
    > Access does not support asynchronous execution, so it cannot be done this
    > way. You should find another way to run this code. For one thing: it is
    not
    > a good idea to automate Access (or any Office app) from ASP code. There
    will
    > be no one sitting at the server to respond to errors.
    >
    > Is it possible to convert the VBA code to a vbscript function that can be
    > run in an ASP page? If so, you can use the XMLHTTPRequest object from
    > client-side code to asynchronously call the page. For details, please post
    > to a client-side code newsgroup devoted to whichever language you are
    using
    > in your client-side code. Look for newsgroups with "dhtml" in their name.
    > m.p.scripting.* will also do.
    >
    > If you need to do this in server-side code, you can use the ServerXMLHTTP
    > object, like this:
    >
    > <%
    > url = "RunSkillSearch.ASP"
    > set xmlhttp = server.CreateObject("MSXML2.ServerXMLHTTP")
    > xmlhttp.open "GET", url, true
    > xmlhttp.send ""
    > set xmlhttp = nothing
    > %>
    >
    > If you need to pass parameters do this instead:
    > url = "RunSkillSearch.ASP?firstname=" & _
    > oUpload.Form("firstname") & "&surname=" & _
    > oUpload.Form("surname")
    >
    >
    > >
    > > 2/ I would like to do a similar thing that i do in VB6 (i am new to
    > > ASP) which i would use this code for:
    > > on error resume next
    > > Set objAccess =
    > > Server.GetObject("Access.Application") If err =
    > > True then Set objAccess =
    > > Server.CreateObject("Access.Application")
    > > End if
    > > Is it possible to check if a version of access is running, like above?
    >
    > Yes. On Error Resume Next works in vbscript.
    >
    > HTH,
    > Bob Barrows
    >
    > --
    > Microsoft MVP - ASP/ASP.NET
    > Please reply to the newsgroup. This email account is my spam trap so I
    > don't check it very often. If you must reply off-line, then remove the
    > "NO SPAM"
    >
    >

    Si Guest

  6. #5

    Default Re: Check code is running: Access/VBA from ASP

    Si wrote:
    > Hi Bob
    >
    > oUpload, is a part of ASPUpload, which is what my predecessor used to
    > upload a Word doc to our webserver.
    >
    > I dont think i explained qu1 too well: I wish to execute the function
    > in access and then release the ASP page from access.
    I understood. The same answer applies: Access does not support asynchronous
    operations. Anything you do with Access requires you to wait for completion.
    > Then the server
    > can busy itself running the code, which only modifies data in the
    > background and the user can continue looking through the website.
    >
    > I dont fancy turning the code into VBScript as it will take much
    > longer to run.
    Not necessarily. Why would you think that?

    The advantage is that you can use the XMLHTTP object to run the code
    asynchronously, allowing the user to "continue looking through the website."


    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.


    Bob Barrows Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139