Duplicate Label SQL Code

Paladon

Registered User.
Local time
Today, 02:30
Joined
Jul 11, 2006
Messages
10
Hi

I have a small problem with a label which runs from a formula and displays as "Possible Duplicate" on my main form when the First and Last Names are entered but already exsist in the database.

I am trying to add a field to this fomula called "[Address]" so that the "Possible Duplicate" formula can check the address line as well as the first and last names, and then be changed to display "Duplicate", I have had many attempts and have been able to make the "Duplicate" formula work with the address field by creating a new function with in the forms control source query "[Contacts Extended]" called "[Address Line]" and after editing the labels code to refer to "[Address Line]" as aposed to "[Contact Name]" it functions but only by using the Address field and not the "[First Name]" "[Last Name]" and "[Address]" fields.

The Unedited Label which displays "Possible Duplicate" from First Name and Last Name Runs from follwing code.

Label Code:
=IIf(DCount("*","[Contacts Extended]","[ID]<>" & Nz([ID],0) & " And [Contact Name]= '" & Replace(Nz([Contact Name]),"'","''") & "'")>0,"Duplicate Record","")

-------

The label code refers to a query called [Contact Extended] and a function called [Contact Name].

Contact Name Code:
Contact Name: IIf(IsNull([Last Name]),IIf(IsNull([First Name]),[Company],[First Name]),IIf(IsNull([First Name]),[Last Name],Replace(Replace("|1 |2","|1",Nz([First Name])),"|2",Nz([Last Name]))))

Is it possible to place the [Address] field into the [Contact Name] Function.

Table Name = [Contacts]
Label Name = [txtDuplicateWarning]


Hope someone can help.



Thanks
Christopher
C.W.Martin@BTInternet.com
 

Users who are viewing this thread

Back
Top Bottom