Question combo bx error msg

Joe8915

Registered User.
Local time
Today, 01:18
Joined
Sep 9, 2002
Messages
820
Here is the bottom line. What I am trying to accomplish is not having duplicate enteries in a combo box. I think I am close now. Here is what I have so far:

1. Main Form called FrmBatch2b
2. Subform Called TblName subform
Link Master field is ID
Link Child field is Name_ID
In the Subform I have two fields
1. Called Name_ID
2. Called FullName (I have changed Fullname to a combo box)
Control Source is Fullname
Row Source is SELECT TblEmpName.FullName, TblEmpName.Name_ID FROM TblEmpName ORDER BY TblEmpName.FullName;
Row Source Type is Table/Query

I have pasted this code:
Private Sub LastName_BeforeUpdate(Cancel As Integer)
If DCount("*", "[TblEmpName]", "[lastname_ID] = '" & Me.[Lastname_ID] & "'") <> 0 Then
Cancel = True
MsgBox "cannot save duplicate", vbExclamation, "Duplicate"
End If
End Sub

I receive a error Object or class does not support the set of events
 
I have got it this far and it works but I would like to it select the name one time only but not twice.


Private Sub FullName_BeforeUpdate(Cancel As Integer)
If DCount("FullName", "qryFullName", "name_ID = '" & Me.name_id & "'") > 0 Then
Cancel = True
MsgBox "cannot save duplicate", vbExclamation, "Duplicate"
End If

End Sub

Thanks
 

Users who are viewing this thread

Back
Top Bottom