Here some code that I use for one of my dbs to do what you are asking.
CODE
Dim TechID As String
Dim TotalHours As String
Dim ProjectHours As String
Dim HistoryMonth As String
Dim Dup As String
Dim ViewID As String
Dim varWhere As Variant
Dim QD As QueryDef
Dim db As Database
Dim rst As Recordset
TechID = Me.TechID
TotalHours = Me.HoursWorked
ProjectHours = Me.ProjectHours
HistoryMonth = Me.StartDate
Me.PreviouslyEntered = Nz(DLookup("HistoryID", "tblHistory", "TechID =" & TechID & "AND HistoryMonth =#" & HistoryMonth & "#"))
If IsNull(Me.PreviouslyEntered) Or Me.PreviouslyEntered = "" Then
Dup = 0
Else
Dup = Me.PreviouslyEntered
End If
If Me.PreviouslyEntered <> 0 Then
Select Case MsgBox("Productivity Data has already been entered for this Tech for the month indicated!" & vbCrLf & _
"Do you want to REPLACE that Data with date currently entered?", vbYesNo + vbQuestion, "Already Entered")
Case vbYes
Set db = CurrentDb()
db.Execute ("UPDATE tblHistory SET tblHistory.TotalHours = " & TotalHours & ", tblHistory.ProjectHours = " & ProjectHours & "," & _
" tblHistory.HistoryMonth = #" & HistoryMonth & "#" & _
" WHERE (((tblHistory.HistoryID)=" & Dup & "));")
Case vbNo
MsgBox "Please pull reports for unchanged data from the Tech Report Menu", vbInformation, "Incorrect Menu"
DoCmd.OpenForm "frmTechReports", , , , , , Me.Name
Me.Visible = False
Exit Sub
End Select
Else
Set db = CurrentDb()
Set rst = db.OpenRecordset("tblHistory")
rst.AddNew
rst!TechID = TechID
rst!TotalHours = TotalHours
rst!ProjectHours = ProjectHours
rst!HistoryMonth = HistoryMonth
rst.Update
rst.close
Set rst = Nothing
End If
HTH.