Originally Posted by
Welshgasman
So show your amended code (within code tags #)
So why not just update the field for the record you are on with Me.Initials = InputPrompt
Well because [FrmHeat] modifies the data in [Heat] table. One of the other subs saves the changes as a new record inside of a table called [HeatHistory] so that we can see changes with a continous form that filters based on the ID.
Only the changes need an ID because it logs the entry and all changes to a Heat record.
Code:
Private Sub SaveHeat(lId As Long)
On Error GoTo HANDLE_ERROR
If (lId <= 0) Then Exit Sub
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("Heat")
With rs
.FindFirst "Id = " & CLng(lId)
If (.NoMatch) Then Exit Sub
.Edit
UnloadControls rs
.Update
AddToHistory rs
.CLOSE
End With
Dim InputPrompt As String
InputPrompt = InputBox("Please Initial", "Initials", Nz(InputPrompt, Right(Application.CurrentDb.Name, 12)))
Dim InpRs As DAO.Recordset
Set InpRs = CurrentDb.OpenRecordset("HeatHistory")
With InpRs
CurrentDb.Execute "UPDATE HeatHistory" _
& " SET Initials = '" & InputPrompt & "'"
End With
ShowHeatSaved txtHeatName
bIsDirty = False
CLEAN_UP:
GoTo EXIT_PROCEDURE
CLEAN_UP_ON_ERROR:
GoTo EXIT_PROCEDURE
EXIT_PROCEDURE:
Exit Sub
HANDLE_ERROR:
MsgBox "Save Heat Error: (" & Err.Number & ") " & Err.Description, vbCritical
GoTo CLEAN_UP_ON_ERROR
End Sub