I would start with the following changes to your code:
Code:
Private Sub TaskID_NotInList(NewData As String, Response As Integer)
On Error GoTo cboTaskID_NotInList_Err
Dim intAnswer As Integer
Dim strSQL As String
intAnswer = MsgBox("The task " & Format(NewData, "00-00") & " is not currently listed." & vbCrLf & _
"Would you like to add it to the list now?" _
, vbQuestion + vbYesNo, "Task")
If intAnswer = vbYes Then
strSQL = "INSERT INTO TaskTable([TaskNumber]) " & _
"VALUES ('" & NewData & "');"
' DoCmd.SetWarnings False
CurrentDb.Execute strSQL, dbFailOnError
' DoCmd.SetWarnings True
MsgBox "The new task has been added to the list." _
, vbInformation, "Task"
Response = acDataErrAdded
Else
MsgBox "Please choose a task from the list." _
, vbInformation, "Task"
Response = acDataErrContinue
End If
cboTaskID_NotInList_Exit:
Exit Sub
cboTaskID_NotInList_Err:
MsgBox Err.Description, vbCritical, "Error"
Resume cboTaskID_NotInList_Exit
End Sub