Solved

running a stored procedure and ability to monitor within Access?

Posted on 2011-09-12
7
226 Views
Last Modified: 2012-05-12
i have an MDB front end which is supposed to run stored procedures off a SQL server on the same box.

the sp's are triggered manually by the end-user with via a form. no problems there.

however, i would also like to open another form which monitors the progress of the sp's. unfortunately, the MDB system is busy (hourglass) and will not update the monitor form (through the OnTimer property)

so unless there is another way to run sp's instead of a pass through query (or ADO recordset) i can't think of another way to separate the query process from the monitor form self updates.

i thought of calling the passthrough query which would be housed in another MDB file. any thoughts? thanks!
0
Comment
Question by:ironpen45
  • 4
  • 3
7 Comments
 
LVL 57
ID: 36524283
<< any thoughts?>>

 Have the SP write out updates to a log table, either as a series of records or update of a single status message field.

 Then in Access, have a form bound to that table.

Jim.
0
 

Author Comment

by:ironpen45
ID: 36524920
<< Have the SP write out updates to a log table, either as a series of records or update of a single status message field.>>

actually, the monitor form shows data from an attached SQL table, which is updated by the SP you're talking about.

the problem, again, is that the form doesn't get updated until the passthrough query is completed. i need the monitor form to update while the process is on-going.
0
 
LVL 57
ID: 36525408
In DAO, you can do something like this:

    sParam = sParam & "?"
    sql = "{?=call qrySoTransPost (" & sParam & ")}"
    Set conPost = GetSQLConnection()
    Set qdf = conPost.CreateQueryDef("", sql)
    qdf.ODBCTimeout = 0
    With qdf
         .Parameters(0).Direction = dbParamReturnValue
         .Parameters("@UserID") = GetCurrentUser()
       
        DoCmd.OpenForm "ServerStatus", "Post", 1000
         .Execute dbRunAsync
         While .StillExecuting
             DoEvents
         Wend
         If .Parameters(0) <> 0 Then
            DoCmd.Hourglass False
            MsgBox "Post failed@@" & .Parameters(0)
            .Close
            conPost.Close
         DoCmd.Close acForm,  "ServerStatus", " Post"
            Exit Sub
         End If
         DoCmd.Close acForm,  "ServerStatus", " Post"
         .Close
    End With

 Key being to specify the dbRunAsync argument.

Jim.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:ironpen45
ID: 36536208
jim. can this code be an OnLoad property for my "ServerStatus" form, instead of having it opened from another?
0
 

Author Comment

by:ironpen45
ID: 36536217
or can i run the stored procedure with the dbRunAsync argument?
0
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 500 total points
ID: 36536374
 Not sure I understand the question.  You need to use the dbRunAsync argument in order for VBA to continue execution once you called the stored proc.

  Beyond that, how you manage the status messaging is up to you.  In the above, that was done with a status form.  The status form was bound to a logging table, which would be cleared by the status form when it was opened.

  The SP then would write to the logging table as it processed.

  When it was done (.StillExecuting = False), the status form would be closed.

Jim.
0
 

Author Closing Comment

by:ironpen45
ID: 36588738
thanks JDettman. i used the dbRunAsync argument in a variation of the code and now works fine.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now