R
RayToddJr
Here is the current code:
Private Sub cboDefendantsName_NotInList(NewData As String, Response As
Integer)
Static fDataChanged As Boolean
Const cFormName = "frmNEWDEFENDANT"
If fDataChanged Then
Response = acDataErrAdded
Exit Sub
End If
If MsgBox("Would you like to add a new Defendant?", vbYesNo) = vbYes Then
DoCmd.OpenForm cFormName, _
Datamode:=acFormAdd, _
WindowMode:=acDialog, _
OpenArgs:=NewData
If SysCmd(acSysCmdGetObjectState, acForm, cFormName) =
acObjStateOpen Then
With Forms(cFormName)
NewData = !LastName & ", " & !FirstName & (" " +
!MiddleName) & (" " + !Suffix)
End With
DoCmd.Close acForm, cFormName
If cboDefendantsName.Value <> NewData Then
fDataChanged = True
cboDefendantsName.Value = NewData
fDataChanged = False
End If
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
Else
Response = acDataErrContinue
End If
End Sub
The problem:
When the user enters a name in the combo box, as an example, "Smith, John
T." and it isn't in the defendantsname table, the notinlist fires correctly.
During the process, the Entry Form opens so that the user can enter the name
into the table.
If the user, changes the name in anyway, as an example, removing the period
from the "T" and the default notinlist message is constantly displayed, as in
it is repeating.
What is possibly causing this?
Thanks,
Ray.
Private Sub cboDefendantsName_NotInList(NewData As String, Response As
Integer)
Static fDataChanged As Boolean
Const cFormName = "frmNEWDEFENDANT"
If fDataChanged Then
Response = acDataErrAdded
Exit Sub
End If
If MsgBox("Would you like to add a new Defendant?", vbYesNo) = vbYes Then
DoCmd.OpenForm cFormName, _
Datamode:=acFormAdd, _
WindowMode:=acDialog, _
OpenArgs:=NewData
If SysCmd(acSysCmdGetObjectState, acForm, cFormName) =
acObjStateOpen Then
With Forms(cFormName)
NewData = !LastName & ", " & !FirstName & (" " +
!MiddleName) & (" " + !Suffix)
End With
DoCmd.Close acForm, cFormName
If cboDefendantsName.Value <> NewData Then
fDataChanged = True
cboDefendantsName.Value = NewData
fDataChanged = False
End If
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
Else
Response = acDataErrContinue
End If
End Sub
The problem:
When the user enters a name in the combo box, as an example, "Smith, John
T." and it isn't in the defendantsname table, the notinlist fires correctly.
During the process, the Entry Form opens so that the user can enter the name
into the table.
If the user, changes the name in anyway, as an example, removing the period
from the "T" and the default notinlist message is constantly displayed, as in
it is repeating.
What is possibly causing this?
Thanks,
Ray.