Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

save field value in another table

Status
Not open for further replies.

123ASP

MIS
Nov 2, 2002
239
US
hi, I have created a datagrid that pull record from one table. The table called contact_log and it has a field called followupAction. For every change in any record, I want to capture the old data for the followup filed to be archived in another table, so

client_call_log table
-----------------------------
client_id | name | followupAction
--------------------------------------------------
1 | Bob | Jone completed the order on 3/2/2004


followup archive table
-------------------------
id | client_id | followupAction_history
------------------------------------------------------
1 | 1 | Smith logged client request on 2/4/2004
2 | 1 | Kim processed client order on 2/7/2004
3 | 1 | kim contacted processed pmt on 3/1/2004

I want to be able to see the latest followup action in the client_call_log table at the same time I want to save all previous follow up actions in a separate table like the one shown above.
I am not sure how to do it in Access database, but when using sql server, I can use the trigger to capture the old field value and insert in the followup_archive table. But the problem I am not using MS sql server, I am using MS Access 2000 and the trigger is not available when creating asp.net page.
Does any one has an idea of how to capture old field data and save it. thanks for your help.
Al
 
Al --

There are several ways to get at this. In Access you'd want to use something similar to the "BeforeUpdate" event. So, what I would do, is store in ViewState (or in a hidden textbox), those values you want to "preserve".

Then, in your code behind, when the time comes to update your records, simply capture the old values at that time and insert them into your archived table.

For example, in your case, you might have 3 hidden textboxes on the form. OnLoad you'd stick the values in them:

Page OnLoad...

a.Text = ID.Text 'these values to be archived if necessary
b.Text = EmployeeID.Text
c.Text = Comments.Text
...
<asp:Label id="a" runat="server" Visible="false"/>
<asp:Label id="b" runat="server" Visible="false"/>
<asp:Label id="c" runat="server" Visible="false"/>
 
thanks for your support.
Since I am not using access forms, so I cannot use after update. but I guess, I can use what you sugguested and I will let you know how things goes
thanks
Al
 
123: You can also put the values in ViewState and recover them from there (more efficient than say in Cache or Session and, for that matter, hidden textboxes).

Check out this thread which, just the other day, we were discussing this very same topic:

thread855-804389

Also, a good article on ViewState can be found at:

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top