Exact match for Non numerical field using If Dcount PROBLEMS

  • Thread starter jerry001 via AccessMonster.com
  • Start date
J

jerry001 via AccessMonster.com

Hello.

I am using the following code to match entries with existing database fields.

if Dcount (("[composite]"), "Patients", [composite] = Me.Composite) > 0 Then .
........

the Composite field is composed automaticaly using Name, Surname, and Yob
so, John Smith born in 1989 has a Composite field johnsmith1989

the idea is to match new entries with old ones.

the problem is that the function returns all values with any part of the
field matching the entry.

I want the code to catch ONLY EXAXT matches.

Can anyone please help?
 
D

Dirk Goldgar

jerry001 via AccessMonster.com said:
Hello.

I am using the following code to match entries with existing database
fields.

if Dcount (("[composite]"), "Patients", [composite] = Me.Composite) > 0
Then .
.......

the Composite field is composed automaticaly using Name, Surname, and Yob
so, John Smith born in 1989 has a Composite field johnsmith1989

the idea is to match new entries with old ones.

the problem is that the function returns all values with any part of the
field matching the entry.

I want the code to catch ONLY EXAXT matches.

Can anyone please help?

Is that an exact quote of your code? If so, it's wrong. Try this:

If DCount ("composite", "Patients", _
"composite = " & Me.Composite) > 0 _
Then .
 
R

RonaldoOneNil

The third part of yopur Dcount is wrong. It needs to be in quotes and because
the composite part is a string it needs single quote delimiters as below.

if DCount ("[composite]", "Patients", "[composite] = '" & Me.Composite &
"'") > 0 Then
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top