Advertisement

02.02.2007 at 07:02AM PST, ID: 22147023
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.8

SP finished

Asked by guilloryt in Microsoft Access Database

I am executing a store procedure from an Access Adp using vb code on a form to update a number of rows. After the update I want to requery the form to display the updated data. Problem is the requery occurs before the update is completed. What is the best method to get the app to wait until the stored procedure fiinished the update?


Code on the form

Set cn = Application.CurrentProject.Connection
'(@Order nvarchar(255), @Material nvarchar(255),@Comments nvarchar(255), @Assign nvarchar(255), @Editor nvarchar(255)   )

strTmp = Nz(Forms.frm_AppendComments.Comments, "")

strTmp = " @Order='" & Me.order & _
                  "', @Item='" & Forms.frm_AppendComments.item & _
                  "', @Comments='" & Forms.frm_AppendComments.Comments & _
                  "', @ArrivalDate='" & Forms.frm_AppendComments.ArrivalDate & _
                  "', @Editor='" & FindNetUserName & _
                  "', @Assign='" & Forms.frm_AppendComments.Assign & _
                  "', @Action='" & Forms.frm_AppendComments.action & _
                  "', @PurchFlag='" & Forms.frm_AppendComments.OptPurch & _
                  "', @ProdFlag='" & Forms.frm_AppendComments.OptProd & _
                  "'"
cn.Execute "exec sp_MassChangeStatus2" & strTmp

me.requery


Store procedure


ALTER PROCEDURE sp_MassChangeStatus2
(@Order nvarchar(255), @Item nvarchar(255),@Comments nvarchar(255),@ArrivalDate datetime,@Editor nvarchar(255), @Assign nvarchar(255),  @Action nvarchar(15),  @PurchFlag int ,@ProdFlag int  )


AS

if @Action = 'OverWrite'

Begin
if @PurchFlag = -1
UPDATE    dbo.tbl_ZMOA_Status2
SET              PurchComments =left (@comments,255) , PurchAssign = @assign, PurchEditor = @Editor, PurchDateEdited = getdate()
FROM         dbo.tbl_ZMOA_Status2
WHERE     (OrderPONumber = @Order) AND (OrderPONumbeItem = @Item)

if @ProdFlag = -1
UPDATE    dbo.tbl_ZMOA_Status2
SET            ProdComments =left (@comments,255),ProdAssign = @assign,ProdEditor = @Editor, ProdDateEdited = getdate()
FROM         dbo.tbl_ZMOA_Status2
WHERE     (OrderPONumber = @Order) AND (OrderPONumbeItem = @Item)
End


if @Action = 'Append'

Begin
if @PurchFlag = -1
UPDATE    dbo.tbl_ZMOA_Status2
SET              PurchComments =left (@comments + ' *** ' + isnull(PurchComments,''),255), PurchAssign = @assign, PurchEditor = @Editor, PurchDateEdited = getdate()
FROM         dbo.tbl_ZMOA_Status2
WHERE     (OrderPONumber = @Order) AND (OrderPONumbeItem = @Item)

if @ProdFlag =-1
UPDATE    dbo.tbl_ZMOA_Status2
SET            ProdComments =left (@comments + ' *** ' +  isnull(ProdComments,''),255),ProdAssign = @assign,ProdEditor = @Editor, ProdDateEdited = getdate()

FROM         dbo.tbl_ZMOA_Status2
WHERE     (OrderPONumber = @Order) AND (OrderPONumbeItem = @Item)
End

if  isdate(@ArrivalDate) = 1
UPDATE    dbo.tbl_ZMOA_Status2
SET            ArrivalDate= @ArrivalDate, ArrivalEditor = @Editor,ArrivalDateEdited = getdate()
FROM         dbo.tbl_ZMOA_Status2
WHERE     (OrderPONumber = @Order) AND (OrderPONumbeItem = @Item)


Start Free Trial
[+][-]02.02.2007 at 09:10AM PST, ID: 18454049

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.02.2007 at 03:59PM PST, ID: 18457117

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Access Database
Sign Up Now!
Solution Provided By: Data-Man
Participating Experts: 2
Solution Grade: A
 
 
 
Loading Advertisement...
20081112-EE-VQP-42