OnChange Update Table

Gary_Mc_Mahon

Board Regular
Joined
Apr 30, 2003
Messages
87
Hi,
I'm trying to create a table that will track all changes made to a form like a history table although this should not be visible to the user.

I've tried to produce the code but with little success. Any help would be great.

Private Sub Date_Time_Submitted_Change()

DoCmd.GoToControl "tbl_Big_Brother"
DoCmd.GoToRecord , "", acNewRec
table!tbl_big_brother!SuspensionID = Forms!frm_account_screen!SuspensionID
table!tbl_big_brother!Field_Changed = "Date/Time Submitted"
table!tbl_big_brother![Date/Time_Changed] = Now()
table!tbl_big_brother!New_Value = Forms!frm_account_screen![Date/Time Submitted]

End Sub

Cheers
Gary
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Have you looked at Recordset?

Eg

Dim rst As Recordset

Set rst = Currentdb.OpenRecordSet("tbl_Big_Brother")

With rst
.AddNew
.Fields("SuspensionID") = Forms!frm_account_screen!SuspensionID
' add similar statements for the other fields
.Update
.Close
End With
 
Upvote 0

Forum statistics

Threads
1,221,805
Messages
6,162,081
Members
451,738
Latest member
gaseremad

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top