I'm working on a button that takes the user to the previous entry for that date/employee. I have that coded but the problem is that I need it to delete the record that they had put in for that date.
Example they put in 1/1/09 and enter data... they try to save... an error message pops up saying data for that date already exists would you like to edit... they click yes then it goes to the previous entry for 1/1/09
The problem is it saves the entry for the previous data as well... and i cant do a beforeUPDATE event because they need to be able to edit and that will catch if they are trying to edit somethign already there.
I also cant do an unbound form because my boss claims that its too much code for someone like him to do when i leave.
All i need is to delete the data before it gets saved when i move to that new record. Thanks for your help.... here is where i want it to go:
iEmpId = DCount("Emp_ID", "tblEmployeeDaily", "Emp_ID = " & Me.Emp_ID & " And DailyDate=#" & Me.DailyDate & "#")
If iEmpId <> 0 Then
If (MsgBox("An entry for this date already exists. " & vbCrLf & _
vbCrLf & "Would you like to edit that record?", _
vbOKCancel, "Duplicate Employee") = vbOK) Then
****** Deletion code here *********
Me.Recordset.FindFirst "DatabaseID = " & Me.DatabaseID & " And DailyDate = #" & Me.DailyDate & "#"
End If
Example they put in 1/1/09 and enter data... they try to save... an error message pops up saying data for that date already exists would you like to edit... they click yes then it goes to the previous entry for 1/1/09
The problem is it saves the entry for the previous data as well... and i cant do a beforeUPDATE event because they need to be able to edit and that will catch if they are trying to edit somethign already there.
I also cant do an unbound form because my boss claims that its too much code for someone like him to do when i leave.
All i need is to delete the data before it gets saved when i move to that new record. Thanks for your help.... here is where i want it to go:
iEmpId = DCount("Emp_ID", "tblEmployeeDaily", "Emp_ID = " & Me.Emp_ID & " And DailyDate=#" & Me.DailyDate & "#")
If iEmpId <> 0 Then
If (MsgBox("An entry for this date already exists. " & vbCrLf & _
vbCrLf & "Would you like to edit that record?", _
vbOKCancel, "Duplicate Employee") = vbOK) Then
****** Deletion code here *********
Me.Recordset.FindFirst "DatabaseID = " & Me.DatabaseID & " And DailyDate = #" & Me.DailyDate & "#"
End If