Private Sub MetricName_NotInList(NewData As String, Response As Integer)
On Error GoTo MetricName_NotInList_Err
Dim intAnswer As Integer
Dim strSQL As String
intAnswer = MsgBox("The metric " & Chr(34) & NewData & Chr(34) & " is not currently listed." & vbCrLf & "Would you like to add it to the list now?", vbYesNo, "Metric Name")
If intAnswer = vbYes Then
strSQL = "INSERT INTO MetricNametbl([MetricName]) " & "VALUES ('" & NewData & "');"
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
MsgBox "The new metric name has been added to the list.: "
Response = acDataErrAdded
Else
MsgBox "Please choose a job title from the list."
Response = acDataErrContinue
End If
MetricName_NotInList_Err:
Exit Sub
MetrinName_NotInlist_Err:
MsgBox Err.Description, vbCritical, "Error"
Resume MetricName_NotInList_Exit
End Sub