Hi,
Im using Access 2003 and SQL Server 2005. I made a stored procedure to do an archiving process, which if theres a change in a certain field, it inserts the certain fields in that row to an "archive" table. The stroed procedure is below:
There is a form, with a subform on it. The subform holds all the fields, and the main form has a text box (called txtRiskID) which holds the value of the ID number for the row that I am on in the subform. An example of where I use the stored procedure is:
The problem I have is that it archives the row with the old value, not the new value. So say the value in Consequence is 3 to begin with, and I change it to 2, it archives the row with Consequence having a value of 3, not 2.
Where am I going wrong?
Many thanks,
Andrew
Im using Access 2003 and SQL Server 2005. I made a stored procedure to do an archiving process, which if theres a change in a certain field, it inserts the certain fields in that row to an "archive" table. The stroed procedure is below:
Code:
alter PROCEDURE [dbo].[usp_RiskChangeArchive] @RiskID int AS BEGIN SET NOCOUNT ON; insert into RiskChangeArchive (RiskID, Risk, ProjectID, PlatformID, ClientID, CategoryID, WBS, Probability, Consequence, RiskRating, Manageability, Criticality, ArchiveMonth) select risk.riskid, risk.risk, risk.projectid, risk.platformid, risk.clientid, risk.categoryid, risk.wbs, risk.probability, risk.consequence, risk.riskrating, risk.manageability, risk.criticality, getdate() as archivemonth from risk where riskid = @RiskID
Code:
Private Sub Consequence_AfterUpdate()
RiskChangeArchive Me.Parent.txtRiskID
End Sub
Where am I going wrong?
Many thanks,
Andrew
Comment