Unanswered: Please help - Code Problem - Disgarding duplicates
I'm trying to stop users creating duplicate Training Events on my system but I'm having a real big problem doing this. I've been experimenting with codes and so far I have the below set up but the program breaks on Set rsc As DAO.Recordset
Can someone help me fix this code?
Public Sub Val_Trainer_AfterUpdate()
Dim EventLinkCriteria As String
Dim rsc As DAO.Recordset
'Check StudentDetails table for duplicate StudentNumber
If DCount("Date" & "Training Course" & "Training Venue" & "Trainer", "Tbl_Courses", EventLinkCriteria) > 0 Then
'Undo duplicate entry
'Message box warning of duplication
MsgBox "Warning Course Event has already been entered." _
& vbCr & vbCr & "You will now been taken to the record.", vbInformation _
, "Duplicate Information"
'Go to record of original Student Number
Me.Bookmark = rsc.Bookmark