Solved

running a stored procedure and ability to monitor within Access?

Posted on 2011-09-12
7
232 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 58
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 58
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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 

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 58

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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

687 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