My Table “Cast” has these fields:
cID (PK), cFName, cMName and cLName
The form I am using to update this table is called fCast.
I would like to prevent entering same name twice. To prevent entering same title twice I am using codes which is working. But I am not sure how to concatenate 3 fields and apply similar codes. Can someone please help? Thanks.
My code to prevent duplicating a title:
cID (PK), cFName, cMName and cLName
The form I am using to update this table is called fCast.
I would like to prevent entering same name twice. To prevent entering same title twice I am using codes which is working. But I am not sure how to concatenate 3 fields and apply similar codes. Can someone please help? Thanks.
My code to prevent duplicating a title:
Code:
Private Sub iTitle_AfterUpdate() Dim iTitle As String Dim stLinkCriteria As String Dim rsc As DAO.Recordset Set rsc = Me.RecordsetClone iTitle = Me.iTitle.Value stLinkCriteria = "[iTitle]=" & "'" & Replace(Me![iTitle], "'", "''") & "'" 'Check Items table for duplicate iTitle If DCount("iTitle", "Items", _ stLinkCriteria) > 0 Then 'Undo duplicate entry Me.Undo 'Message box warning of duplication MsgBox "Warning Item Title " _ & iTitle & " has already been entered." _ & vbCr & vbCr & "You will now been taken to the record.", _ vbInformation, "Duplicate Information" 'Go to record of original Title rsc.FindFirst stLinkCriteria Me.Bookmark = rsc.Bookmark End If Set rsc = Nothing End Sub
Comment