I have a view called Duplicate checker that stores 3 fields from my main user input form. Behind my querysave event I have some LotusScript that checks this view and if the 3 main fields match entries in my view’s columns than it displays an error message saying this could be a duplicate entry, and duplicate entries are bad in my case because they would disturb report totals and so forth. I have many fields on this form but it is only necessary to check these 3 fields for possible duplicate entry. My problem then becomes my edit action. If a user were to press my edit action to change an erroneous field they would also have to change one of the 3 fields being checked against my Duplicate checker view, in order to save the document, or else they will get the error message saying that this is a duplicate entry. Below is the code I am using, is there anyway to edit the document without changing these 3 fields and still save document without the error message, sometimes it will be necessary to change these 3 fields in which case it works out fine. Still kind of new to LotusScript so I am still learning.
Dim docStatus As String
Dim docStart As String
Dim docData As String
docStatus = uidoc.FieldGetText("DutyStat")
docStart = uidoc.FieldGetText("Date")
docData = uidoc.FieldGetText("TrooperNumber")
Dim dc As NotesViewEntryCollection
Dim Key(0 To 2) As Variant
Key(0) = docStatus
Key(1) = docStart
Key(2) = docData
Set view = db.GetView("DuplicateChecker")
Set dc = view.GetAllEntriesByKey(Key, True)
If dc.Count = 0 Then
Exit Sub
Else
Messagebox"This entry could be a duplicate, please make sure the DUTY STATUS is accurate.",48,"Error."
Continue = False
Exit Sub
End If