G
Guest
I have the follwing code for OnNotInList and AfterUpdate Events:
Private Sub Steward_s_Name_NotInList(NewData As String, Response As Integer)
If MsgBox("The Union Representative's name you entered was not found, do you
want to add the name you entered?", _
vbYesNo + vbQuestion, _
"Please Respond") = vbYes Then
DoCmd.OpenForm "UnionRepsList", _
Datamode:=acFormAdd, _
WindowMode:=acDialog, _
OpenArgs:=NewData
If IsLoaded("UnionRepsList") Then
Response = acDataErrAdded
DoCmd.Close acForm, "UnionRepsList"
Else
Response = acDataErrContinue
End If
Else
Response = acDataErrContinue
End If
End Sub
================================================
Private Sub Steward_s_Name_AfterUpdate()
Me.Requery
Me.Refresh
End Sub
================================================
My problem is that after entering the new name in the form UnionRepsList,
the new name does not appear in the combo box named Steward's_Name. As a
consequence I cannot select the new name and I get the same error message
that the name is not in the list. After selecting a differnt name in the
combo box and after entering the next control, I can go back to the combo box
and see the newly entered name.
What is problem with my code?
Thanks for the help.
Private Sub Steward_s_Name_NotInList(NewData As String, Response As Integer)
If MsgBox("The Union Representative's name you entered was not found, do you
want to add the name you entered?", _
vbYesNo + vbQuestion, _
"Please Respond") = vbYes Then
DoCmd.OpenForm "UnionRepsList", _
Datamode:=acFormAdd, _
WindowMode:=acDialog, _
OpenArgs:=NewData
If IsLoaded("UnionRepsList") Then
Response = acDataErrAdded
DoCmd.Close acForm, "UnionRepsList"
Else
Response = acDataErrContinue
End If
Else
Response = acDataErrContinue
End If
End Sub
================================================
Private Sub Steward_s_Name_AfterUpdate()
Me.Requery
Me.Refresh
End Sub
================================================
My problem is that after entering the new name in the form UnionRepsList,
the new name does not appear in the combo box named Steward's_Name. As a
consequence I cannot select the new name and I get the same error message
that the name is not in the list. After selecting a differnt name in the
combo box and after entering the next control, I can go back to the combo box
and see the newly entered name.
What is problem with my code?
Thanks for the help.