Private Sub FlavorID_NotInList(NewData As String, Response As Integer)
On Error GoTo SomethingBadHappened
Dim rstFlavors As ADODB.Recordset
Dim intAnswer As Integer
intAnswer = MsgBox("Add " & NewData & " to the list of flavors?", _
vbQuestion + vbYesNo)
If intAnswer = vbYes Then
Set rstFlavors = New ADODB.Recordset
rstFlavors.Open "Flavors", CurrentProject.Connection, _
adOpenStatic, adLockOptimistic, adCmdTable
rstFlavors.AddNew
rstFlavors!Flavor = NewData
rstFlavors.Update
Response = acDataErrAdded
Else
Response = acDataErrDisplay
End If
rstFlavors.Close
Set rstFlavors = Nothing
Exit Sub
SomethingBadHappened:
MsgBox "When trying to process this order, something bad happened" & _
vbCrLf & "Please contact the program vendor and " & _
"report the error as follows" & vbCrLf & _
"Error #: " & Err.Number & vbCrLf & _
"Description: " & Err.Description
Resume Next
End Sub
|