[COLOR=royalblue]
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim YesNo As String
If Me.Dirty = True Then
YesNo = MsgBox("You have made changes to this record. Do you want to save them?", vbYesNo)
If YesNo = vbYes Then
DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO tblComponentHistory ( [DateTime] ) " _
& "SELECT tblCurrentComponents.*, Now() AS [DateTime] " _
& "FROM tblCurrentComponents " _
& "WHERE (((tblCurrentComponents.ID)=[Forms]![[Color=Red]frmCurrentComponents[/Color]]![ID]));"
DoCmd.SetWarnings True
Else
ID.SetFocus
Dim ctlTextbox As Control
For Each ctlTextbox In Me.Controls
If ctlTextbox.ControlType = acTextBox And Not ctlTextbox.Name = "ID" Then
ctlTextbox.Value = ctlTextbox.OldValue
End If
Next ctlTextbox
End If
End If
End Sub
[/COLOR]