Dublicated records

alpertunga65

Registered User.
Local time
Today, 08:08
Joined
Mar 15, 2013
Messages
21
Hi everyone

Actually I had posted a thread about this issue but I could not get any answer. Then, I tried to do something to solve the problem

In my database, I am assigning frequencies (TEMASFRE), to the radionets at their locations (VERYERID).

I want to assign any frequency to a radionet at the same location only one time…
If I dublicate the record, then I want to have a warning message about dublicated record.

Frequency and VERYERID values are numeric.

here is my code;

My form name is TLSCVRFREKANSISLEMLERI, table has the same name.

Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim HUSO1, HUSO2 As Integer
Dim stLinkCriteria1, stLinkCriteria2 As Integer
Dim rsc As DAO.Recordset

Set rsc = Me.RecordsetClone
HUSO1 = Me.[TEMASFRE].Value
HUSO2 = Me.[VERYERID].Value
stLinkCriteria1 = "[TEMASFRE]=" & HUSO1

stLinkCriteria2 = "[VERYERID]=" & HUSO2
If DCount("[TEMASFRE]", "TLSCVRFREKANSISLEMLERI", stLinkCriteria1) And DCount("[VERYERID]", "TLSCVRFREKANSISLEMLERI", stLinkCriteria2) > 0 Then
'Undo duplicate entry
Me.Undo

MsgBox "Girmeye çalıştığınız " _
& HUSO & " No'lu ALANADI daha önce girilmiş." _
& vbCr & vbCr & "Lütfen Kayıtlarınızı Kontrol Ediniz.", vbInformation _
, "Tekrarlanan ALANADI Numarası"

rsc.FindFirst stLinkCriteria1
Me.Bookmark = rsc.Bookmark
End If
Set rsc = Nothing

End Sub

Could you pls help for the code? Correct or not???
 

Users who are viewing this thread

Back
Top Bottom