S
Sharon
Private Sub Supplier_NotInList(NewData As String, Response As Integer)
On Error GoTo SomethingBadHappened
Dim rstSupplier As ADODB.Recordset
Dim intAnswer As Integer
intAnswer = MsgBox("Add " & NewData & " to the list of suppliers?", _
vbQuestion + vbYesNo)
If intAnswer = vbYes Then
Set rstSuppliers = New ADODB.Recordset
rstSupplier.Open "frmSupplier", CurrentProject.Connection, _
adOpenStatic, adLockOptimistic, adCmdTable
rstSupplierName.AddNew
rstSupplier!Supplier = NewData
rstSupplier.Update
Response = acDataErrAdded
Else
Response = acDataErrDisplay
End If
rstSupplier.Close
Set rstSupplier = 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
On Error GoTo SomethingBadHappened
Dim rstSupplier As ADODB.Recordset
Dim intAnswer As Integer
intAnswer = MsgBox("Add " & NewData & " to the list of suppliers?", _
vbQuestion + vbYesNo)
If intAnswer = vbYes Then
Set rstSuppliers = New ADODB.Recordset
rstSupplier.Open "frmSupplier", CurrentProject.Connection, _
adOpenStatic, adLockOptimistic, adCmdTable
rstSupplierName.AddNew
rstSupplier!Supplier = NewData
rstSupplier.Update
Response = acDataErrAdded
Else
Response = acDataErrDisplay
End If
rstSupplier.Close
Set rstSupplier = 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