Link to home
Start Free TrialLog in
Avatar of SteveL13
SteveL13Flag 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
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 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
Never mind. It IS working.  Thanks.  I do have another question closely related but I'll post another topic.