Thanks for the replies. This is what I have come up with... When I add a new
address the "Unknown Address" box comes up and asks if i want to add the
address. I click Yes. Then "Run-time error 3192" Could not find output table
tblBillTo, i click debug and it takes me to the VB editor and this is what I
have..
Private Sub Combo14_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 Address...")
If i = vbYes Then
strSQL = "Insert Into tblBillTo ([strCompany]) " & _
"values ('" & NewData & "');"
***** CurrentDb.Execute strSQL, dbFailOnError ***********
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
End Sub
******* Is the line highlighted **********
BillTo is the table where the Address is stored and Company is the name of
the Field List...
Ofer said:
Check this link on "How to use the Microsoft Access Not In List event of a
combo box
" for a sample code on how to do this
http://www.databasedev.co.uk/not_in_list.html