Formula change (1 Viewer)

frankt68

Registered User.
Local time
Today, 06:12
Joined
Mar 14, 2012
Messages
90
Hi!

I ask for your assistance in the following matter:
I have a form with a textbox for the warning about the possible duplication.
In the control source I have a formula

"=IIf(DCount("*";"[Pacient]";"[ID]<>" & Nz([ID];0) & " And [LastName] = '" & Replace(Nz([LastName]);"'";"''") & "'")>0;"Duplicates possible!";"")

that I copied from one of the Microsoft template and slightly adjusted.
I admit that I do not know much about Access:(, but if I understand correctly, the formula checks whether there are duplicate entries in the [LastName] field. I want to know how to check for duplicate entries in more than just one field, for example for the fields [LastName] and [FirstName]?

I use Access 2007 and 2010.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 00:12
Joined
Feb 19, 2002
Messages
43,223
Some language packs use ; as the operand separator rather than , so I am assuming that the seim-colon is correct for your language pack.

=IIf(DCount("*";"[Pacient]";"[LastName] = '" & Me.LastName & "' AND [FirstName] = '" & Me.FirstName & "' AND [somenumericfield] = " & Me.SomeNumericField))>0;"Duplicates possible!";"")
 

frankt68

Registered User.
Local time
Today, 06:12
Joined
Mar 14, 2012
Messages
90
Some language packs use ; as the operand separator rather than , so I am assuming that the seim-colon is correct for your language pack.

=IIf(DCount("*";"[Pacient]";"[LastName] = '" & Me.LastName & "' AND [FirstName] = '" & Me.FirstName & "' AND [somenumericfield] = " & Me.SomeNumericField))>0;"Duplicates possible!";"")


It works. Thanks.
 

Users who are viewing this thread

Top Bottom