By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,483 Members | 3,229 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,483 IT Pros & Developers. It's quick & easy.

NotInList event adds records twice

P: n/a
I have a table named tblSkills consisting of two fields named
ContactID and Skills. The table does not have a key.

The NotInList code below is for a subform that consists of a text
field with a control source of ContactID and also a combo box with a
control source of Skills and a row source of Select tblSkills.Skills
ORDER BY tblSkills.

The code below adds a record to the table twice. How can this be



Private Sub cboSkills_NotInList(NewData As String, Response As
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Set cnn = CurrentProject.Connection
Set rst = New ADODB.Recordset

rst.Open Source:="tblSkills", ActiveConnection:=cnn, _
CursorType:=adOpenKeyset, LockType:=adLockPessimistic

If Me.txtContactID > 0 Then
With rst
!ContactID = Me.txtContactID
!Skills = NewData
End With
Response = acDataErrAdded
Response = acDataErrContinue
MsgBox "Skill was not added to list."
End If

Set rst = Nothing
End Sub
Nov 12 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.