Not In List Code (1 Viewer)

Status
Not open for further replies.

sredworb

Detective Browder
Local time
Today, 15:47
Joined
Mar 28, 2005
Messages
2
Private Sub cbo"Name"_NotInList(NewData As String, Response as Integer)
Dim strMsg As String
Dim rst As DAO.Recordset
Dim db As DAO.Database

strMsg = "'" & NewData & "' is not in the list. "
strMsg = strMsg & "Would you like to add it?"
If vbNo = MsgBox(strMsg, vbYesNo + vbQuestion,"New Company") Then
Response = acDataErrDisplay

Else

Set db = CurrentDb()
set rst = db.OpenRecordset(tbl"Name")
rst.AddNew
rst("Company") = NewData
rst.update
Response = acDataErrAdded
rst.Close

End If
End Sub
 
Status
Not open for further replies.

Users who are viewing this thread

Top Bottom