Avatar of SteveL13
SteveL13
Flag for United States of America asked on

Warning if name already exists in database

I'm trying to alert a user if a name already exists in the database.  Something is wrong with this code.  Can someone tell me what it is?  The syntax is wrong in the first line.

    If DCount("*", "Member Table", "MemberFullName = '" & Me.txtMemberFullName & "') > 0 then
        MsgBox "There is already a member in the database with this name.", vbOKOnly
    End If
Microsoft Access

Avatar of undefined
Last Comment
SteveL13

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Rey Obrero (Capricorn1)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SteveL13

ASKER
I provided the wrong info.  I actually have to check for a duplicate record using first and last name.  Here is my before update code but the warning is not appearing:  (now what am I doing wrong?)

    If DCount("*", "Member Table", "MemberFirstName = '" & Me.txtMemberFirstName & "' AND MemberLastName = '" & Me.txtMemberLastName & "'") > 0 Then
        MsgBox "There is already a member in the database with this name.", vbOKOnly
    End If
SteveL13

ASKER
Never mind. It IS working.  Thanks.  I do have another question closely related but I'll post another topic.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23