combo box (1 Viewer)

adil_karampurwa

Registered User.
Local time
Today, 12:49
Joined
Sep 18, 2006
Messages
23
In the from "send mail" i have a combox "to" which is bounded to a field "names" in the table "email". i want new names to be added to the list automatically so In its "notinlist" event i have put this code...


Private Sub txtTo_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 Book Category...")
If i = vbYes Then
strSQL = "Insert Into tblemail ([strtxtTO]) values ('" & NewData & "')"
CurrentDb.Execute strSQL, dbFailOnError
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If

End Sub


but getting errors.
plz help
 

Users who are viewing this thread

Top Bottom