Kod:
Private Sub STOKADI_NotInList(NewData As String, Response As Integer)
Dim strSQL As String
Dim i As Integer
Dim Msg As String
If NewData = "" Then Exit Sub
Msg = "'" & NewData & "' listenizde yok." & vbCr & vbCr
Msg = Msg & "Eklemek ister misiniz?"
i = MsgBox(Msg, vbQuestion + vbYesNo, "Listede Olmayan Stok adı...")
If i = vbYes Then
strSQL = "Insert Into URUNLER ([STOKADI]) " & _
"values ('" & NewData & "');"
CurrentDb.Execute strSQL, dbFailOnError
DoCmd.OpenForm "URUNLER", acNormal, [STOKADI] = Me.STOKADI
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
End Sub