-----Original Message-----
Your code needs a slight tweak...the rs.Close statement should be inside of
the first End If block.
Private Sub Source_NotInList(NewData As String, Response
As Integer)
Dim db As dAO.database
Dim rs As DAO.Recordset
Dim strMsg As String
strMsg = "'" & NewData & "is not an available AE Name"
& vbCrLf & vbCrLf
strMsg = strMsg & "Do you want to associate the new
Name to the current list?"
strMsg = strMsg & vbCrLf & vbCrLf & "Click Yes to link
or No to re-type it."
If MsgBox(strMsg, vbQuestion + vbYesNo, "Add new
name?") = vbNo Then
Response = acDataErrContinue
Else
Set db = CurrentDb
Set rs = db.openrecordset("tblsource",
dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!AEname = NewData
rs.Update
If Err Then
MsgBox "An error occurred. Please try again."
Response = acDataErrContinue
Else
Response = acDataErrAdded
End If
rs.Close
Set rs = Nothing
Set db = Nothing
End If
--
Ken Snell
<MS ACCESS MVP>
.