I have put in the code listed below. However, Nothing is happening. It will not ask me if I want to add to the list or anything else. Can someone tell me what I did wrong?
Private Sub SSN_NotInList(NewData As String, Response As Integer)
'Suppress the default error message.
Response = acDataErrContinue
'Prompt user to verify they wish to add new value.
If MsgBox("The SSN is not in list. Add it?", vbYesNo) = vbYes Then
'Set Response argument to indicate that data is being added.
'Open a recordset of the SSN Table.
Dim db As Database
Dim rstSSN As Recordset
Dim sqlSSN As String
Set db = CurrentDb()
sqlSSN = "Select * From SSN"
Set rstSSN = db.OpenRecordset(sqlSSN, dbOpenDynaset)
'Add a new SSN with the value that is stored in the variable NewData.
rstSSN.AddNew
rstSSN![SSN] = NewData
rstSSN.Update
'Inform the combo box that the desired item has been added to the list.
Response = acDataErrAdded
rstSSN.Close 'Close the recordset
End If
End Sub
Private Sub SSN_NotInList(NewData As String, Response As Integer)
'Suppress the default error message.
Response = acDataErrContinue
'Prompt user to verify they wish to add new value.
If MsgBox("The SSN is not in list. Add it?", vbYesNo) = vbYes Then
'Set Response argument to indicate that data is being added.
'Open a recordset of the SSN Table.
Dim db As Database
Dim rstSSN As Recordset
Dim sqlSSN As String
Set db = CurrentDb()
sqlSSN = "Select * From SSN"
Set rstSSN = db.OpenRecordset(sqlSSN, dbOpenDynaset)
'Add a new SSN with the value that is stored in the variable NewData.
rstSSN.AddNew
rstSSN![SSN] = NewData
rstSSN.Update
'Inform the combo box that the desired item has been added to the list.
Response = acDataErrAdded
rstSSN.Close 'Close the recordset
End If
End Sub