combo Box with NotInList error routine. next step?

  • Thread starter Thread starter Carl
  • Start date Start date
C

Carl

I have the code to open a form and add a name if the name does not appear in
combo box, but when I close the data input form the combo box does not pick
up the fact that the
name has beeen added.
What am I missing?

Here is what i have:
Private Sub cboLastName_NotInList(NewData As String, Response As Integer)
Dim intReply As Integer
intReply = MsgBox("The teammate's name '" & NewData & _
"' is not in the list. Would you like to add?", vbYesNo)
If intReply = vbYes Then
DoCmd.OpenForm "frmTeammates", , , , acFormAdd, acDialog, NewData
'-- Record added, so cancel Access's default processing
Response = acDataErrAdded
Else
MsgBox "Please select an item in the list."
Response = acDataErrContinue
End If
End Sub

Carl
 
Carl, I would expect your code to work if the bound column of the combo is
the one that the NewData is being added to. It won't work if combo's bound
column is zero-width, so that the data being added is not the same as the
key value.
 
Thank you I will try that out.
Carl
Allen Browne said:
Carl, I would expect your code to work if the bound column of the combo is
the one that the NewData is being added to. It won't work if combo's bound
column is zero-width, so that the data being added is not the same as the
key value.
 
Back
Top