maxmangion
AWF VIP
- Local time
- Today, 15:07
- Joined
- Feb 26, 2003
- Messages
- 2,805
i have a table with 2 fields (StampID and ThemeID). Now i created a query with 3 fields (StampID, ThemeID and the third field as follows
validate:[StampID] & "," & [ThemeID]
now i created a form with 2 fields (StampID and ThemeID). i created an unbound box (Text7) and i wrote in it =[StampID] & "," & [ThemeID]
Now in the before update of the form i did the following code:
Is this a correct approach to avoid duplicate records in this table ?
validate:[StampID] & "," & [ThemeID]
now i created a form with 2 fields (StampID and ThemeID). i created an unbound box (Text7) and i wrote in it =[StampID] & "," & [ThemeID]
Now in the before update of the form i did the following code:
Code:
Dim counter As Long
counter = DCount("*", "qryStampsThemes", "validate = forms!frmStampsThemes!Text7")
If counter > 0 Then
If MsgBox("Record already exist" & vbCrLf & "Discard Record (Yes) or Amend Record (No)", vbYesNo, "Duplication Error") = vbYes Then
Cancel = True
Me.Undo
MsgBox "Recorded Discard Successfully"
Else
Me.ThemeID = ""
Me.ThemeID.SetFocus
End If
End If
Is this a correct approach to avoid duplicate records in this table ?