I don't want the end user to be able to have duplicate records for the same date and shift. (I have a control number as a primary key field due to the large amount of related data - backend in SQL, front in Access)
example:
date 10/1/10 shift 1 (good)
date 10/1/10 shift 2 (good)
date 10/1/10 shift 1 - alert end user after entering shift 1 that this data has already been entered.
I have code:
Private Sub SHIFT_AfterUpdate()
If DCount("[DATE]&[SHIFT]", "[tblProduction]", "[DATE]&[SHIFT]='" & tblProduction & "'") > 0 Then
MsgBox "Duplicate"
DoCmd.CancelEvent
End If
This runs through code but does not alert me when there are 2 records with matching date&shift.
Any help?
example:
date 10/1/10 shift 1 (good)
date 10/1/10 shift 2 (good)
date 10/1/10 shift 1 - alert end user after entering shift 1 that this data has already been entered.
I have code:
Private Sub SHIFT_AfterUpdate()
If DCount("[DATE]&[SHIFT]", "[tblProduction]", "[DATE]&[SHIFT]='" & tblProduction & "'") > 0 Then
MsgBox "Duplicate"
DoCmd.CancelEvent
End If
This runs through code but does not alert me when there are 2 records with matching date&shift.
Any help?