S
scott
I'm using a MsgBox in a combo control's NotInList event to give the user a
choice to add a new combo entry. It works fine except when the user clicks
No. Access displays the NotInList error and returns to the combo. Can
someone help me suppress this error?.
CODE: *********************
Private Sub cbo_userID_NotInList(NewData As String, Response As Integer)
Dim sName As String, sLast As String, sFirst As String, iComma As
Integer
Dim iReturn As Integer, varName As Variant
sName = NewData
iComma = InStr(sName, ",")
If iComma = 0 Then
sLast = sName
Else
sLast = Left(sName, iComma - 1)
sFirst = Mid(sName, iComma + 2)
End If
iReturn = MsgBox("The user " & sName & _
" is not in the system. Do you want to add this User?", _
vbQuestion + vbYesNo, CurrentProject.Properties("AppTitle").Value)
If iReturn = vbYes Then
DoCmd.OpenForm FormName:=" frmUserAdd", _
DataMode:=acAdd, WindowMode:=acDialog, OpenArgs:=sName
Response = acDataErrAdded
Else ' ERROR HAPPENS HERE
End If
Exit Sub
Response = acDataErrAdded
End Sub
choice to add a new combo entry. It works fine except when the user clicks
No. Access displays the NotInList error and returns to the combo. Can
someone help me suppress this error?.
CODE: *********************
Private Sub cbo_userID_NotInList(NewData As String, Response As Integer)
Dim sName As String, sLast As String, sFirst As String, iComma As
Integer
Dim iReturn As Integer, varName As Variant
sName = NewData
iComma = InStr(sName, ",")
If iComma = 0 Then
sLast = sName
Else
sLast = Left(sName, iComma - 1)
sFirst = Mid(sName, iComma + 2)
End If
iReturn = MsgBox("The user " & sName & _
" is not in the system. Do you want to add this User?", _
vbQuestion + vbYesNo, CurrentProject.Properties("AppTitle").Value)
If iReturn = vbYes Then
DoCmd.OpenForm FormName:=" frmUserAdd", _
DataMode:=acAdd, WindowMode:=acDialog, OpenArgs:=sName
Response = acDataErrAdded
Else ' ERROR HAPPENS HERE
End If
Exit Sub
Response = acDataErrAdded
End Sub