I have a textbox call Staff_ID, I don't want my user to type the same Staff_ID . So I write the vba code like this

Code:
Private Sub Staff_ID_AfterUpdate()
Dim SID As String
Dim stLinkCriteria As String
Dim rsc As DAO.Recordset

Set rsc = Me.RecordsetClone
SID = Staff_ID.Value
stLinkCriteria = "[Staff_ID]=" & "'" & SID & "'"

    If DCount("Staff_ID",
...