Hi Bob , Paul and Rainlover
Sorry have been studying which code can be used to solve this hence did not reply. Please see the code which i have used but it doesnt work.. :-( I know it may look a bit haywire but i read books and have tried getting this as i am coding nearly after a decade.... Thank you for helping me...
This does not do what I want. I want the database to prompt the user that the data already exists and if the user wants to edit the existing data or add a new data (new record).... Please help me team... I am unable to sleep bcus of this as i am unable to know how to proceed...
Private Sub Ctl_Lname_BeforeUpdate(Cancel As Integer)
If Me.NewRecord Then
Dim Lname As String
Dim rsc As DAO.Recordset
Set rsc = Me.RecordsetClone
Lname = Me.Lname.Value
Lname = "[Lname]=" & "'" & Marketing & "'"
'Check Marketing table for duplicate entry
If DCount " [Lname]= " & Marketing & " ' AND Fname<> '' & me.Lname
Undo duplicate entry
Me.Undo
'Message box warning of duplication
MsgBox "Warning: " _
& Lname & " has already been entered." _
& vbCr & vbCr & "You will now been taken to the record.", _
vbInformation, "Duplicate Information"
'Go to record of original record
rsc.FindFirst Lname
Me.Bookmark = rsc.Bookmark
End If
Set rsc = Nothing
End Sub