MsgBox (Duplication in name)

Mr.Access

Registered User.
Local time
Today, 06:33
Joined
Jan 28, 2007
Messages
47
Dear Friends,

I have an Employee table which includes:

Emp_ID (PK)
…….
FamilyName
First _Name
……
…..

In this case where the name is separated in to textboxes , how can I generate a MsgBox that indicated the name is already inserted (Duplication in name) in case of ? .

Kind Regards,
 
I would perform a query to the Employee table to see if a match exists. If theres a match perform a MsgBox.
 
Hi DreamAwake,

Could it be by using the Dlookup( ) ?

Thanks.
 
OK,
I have the query [Name_Duplication] contains the Family_Name & First_Name
selected from the form.
I made the action after entering the First_Name which is the second one as follow.

--------------------------------------------------------------
Private Sub First_Name_AfterUpdate()
DoCmd.OpenQuery "Name_Duplication", acHidden
If DCount("[Family_Name]", "Name_Duplication") > 1 Then
MsgBox ("Duplication !!")
End If
End Sub
-------------------------------------------------------------
The problem is that the query is still pop up even i tried the (acHidden).
How can I disappear it ?
Any ideas ?
Thanks.
 
a) what if you have really have two employees with the same name

b) you dont need to open the query at all - just do the dcount - then you wont see the query datasheet

c) you may want to do your test in the before update event not the after update event. if the existing total is 1, the name is a duplicate - then you might want to ask whether to allow the entry or cancel it.

putting it in the afterupdate event means the wrong data is already there.
 

Users who are viewing this thread

Back
Top Bottom