J
jenniferspnc
Slight problem. I have an unbound combo box and "not in list" code tied to
it...see below. The user goes in to add a new entry and gets the prompt to
add...it works but the screen doesn't refresh...meaning the user can click on
the new manufacturer but it shows a part under it (that's really tied to
another manufacturer). But close the form and open it then the new
manufacturer shows up with no parts tied (as it should be since there haven't
been parts added). How do I get it to show the new manufacturer and nothing
tied to it.
The combo box is in the detail and the parts pull in via a subform.
Private Sub Combo23_NotInList(NewData As String, Response As Integer)
Dim strSQL As String
Dim i As Integer
Dim Msg As String
'Exit this sub if the combo box is cleared
If NewData = "" Then Exit Sub
Msg = "'" & NewData & "' is not currently in the list." & vbCr & vbCr
Msg = Msg & "Do you want to add it?"
i = MsgBox(Msg, vbQuestion + vbYesNo, "Unknown Manufacturer...")
If i = vbYes Then
strSQL = "Insert Into tbl_manufacturer ([manufacturer]) " & _
"values ('" & NewData & "');"
CurrentDb.Execute strSQL, dbFailOnError
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
End Sub
it...see below. The user goes in to add a new entry and gets the prompt to
add...it works but the screen doesn't refresh...meaning the user can click on
the new manufacturer but it shows a part under it (that's really tied to
another manufacturer). But close the form and open it then the new
manufacturer shows up with no parts tied (as it should be since there haven't
been parts added). How do I get it to show the new manufacturer and nothing
tied to it.
The combo box is in the detail and the parts pull in via a subform.
Private Sub Combo23_NotInList(NewData As String, Response As Integer)
Dim strSQL As String
Dim i As Integer
Dim Msg As String
'Exit this sub if the combo box is cleared
If NewData = "" Then Exit Sub
Msg = "'" & NewData & "' is not currently in the list." & vbCr & vbCr
Msg = Msg & "Do you want to add it?"
i = MsgBox(Msg, vbQuestion + vbYesNo, "Unknown Manufacturer...")
If i = vbYes Then
strSQL = "Insert Into tbl_manufacturer ([manufacturer]) " & _
"values ('" & NewData & "');"
CurrentDb.Execute strSQL, dbFailOnError
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
End Sub