combo Box with NotInList error routine. next step?

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
 
A

Allen Browne

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.
 
C

Carl

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top