Hi After a lot of struggling I managed to get this to work:
Code:
Private Sub Module_Code_AfterUpdate()
Dim strCriteria As String
strCriteria = "Module_Code=" & Chr(34) & Me.Module_Code & Chr(34) & " AND Course=" & Chr(34) & Me.Course & Chr(34)
If DCount("Module_Code", "tbl Stages", strCriteria) > 0 Then
MsgBox ("You have already entered this module code")
End If
End Sub
It is used to warn if a duplicate value for a Module is being added on a sub form. There are instances where there can be two modules (but they are rare).
What I want the Dialogue that warns of a duplicate record to ideally do is have a Yes/ no question which is : "You have already entered this module code, do you want to delete this record?" where if the User clicks Yes the current record on the sub form is deleted and if they Click no they can continue to update the remaining parts of the record. I think this should be straightforward but have been fiddling with it for ages and can't see the wood for the tress anymore!
Thanks