Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Duplicate Record - Alert End User

Status
Not open for further replies.

wz

Programmer
Feb 16, 2001
88
0
0
US
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?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top