warning of possible duplicate record

S

segurarl

I have a 'text' field for the account number.

How can I set up a "warning message" to the user when a new record could be
a duplicate.

For example: existing account number N-5189
New account number N5189 or 5189-N

I'd like to give the user the option of:

1) See the existing account (in a new window to find out if it is the same)
2) Ignore the warning and go ahead with the new record anyway.

Thank you!
 
D

Douglas J. Steele

In the form's BeforeInsert event, you'll have to put logic that does the
"fuzzy" lookups in which you're interested (using a recordset, or DLookup).
If they come back positive (i.e.: you find a potential match), ask the user
(using a MsgBox) whether they want to continue, or see the existing
account(s). If they say Yes, open a Modal window that displays the matching
data. Once that form has closed, if they say they don't want to save the
record, set Cancel = True in the BeforeInsert event, and undo their changes
(Me.Undo)
 
Top