CODE
Private Sub PatientName_NotInList(NewData As String, Response As Integer)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim msg As String
' Confirm that the user wants to add the new POC.
msg = " Patient not in the list." & vbCr & vbCr
msg = msg & "Do you want to add it?"
If MsgBox(msg, vbQuestion + vbYesNo) = vbNo Then
' If the user chose not to add a updater, set the Response argument to suppress an error message and undo changes.'
Response = acDataErrContinue
' Display a customized message.
MsgBox "Please try again."
Else
' If the user chose to add a new POC, open a recordset using the PatientData table.'
Set db = CurrentDb
DoCmd.OpenForm "frmPatientData", , , , acFormAdd, acDialog
' Set Response argument to indicate that new data is being added.
Response = acDataErrAdded
End If
Exit_PatientName_NotInList:
Exit Sub
Err_PatientName_NotInList:
' An unexpected error occurred, display the normal error message.
MsgBox Err.Description
' Set the Response argument to suppress an error message and undo
' changes.
Response = acDataErrContinue
End Sub
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim msg As String
' Confirm that the user wants to add the new POC.
msg = " Patient not in the list." & vbCr & vbCr
msg = msg & "Do you want to add it?"
If MsgBox(msg, vbQuestion + vbYesNo) = vbNo Then
' If the user chose not to add a updater, set the Response argument to suppress an error message and undo changes.'
Response = acDataErrContinue
' Display a customized message.
MsgBox "Please try again."
Else
' If the user chose to add a new POC, open a recordset using the PatientData table.'
Set db = CurrentDb
DoCmd.OpenForm "frmPatientData", , , , acFormAdd, acDialog
' Set Response argument to indicate that new data is being added.
Response = acDataErrAdded
End If
Exit_PatientName_NotInList:
Exit Sub
Err_PatientName_NotInList:
' An unexpected error occurred, display the normal error message.
MsgBox Err.Description
' Set the Response argument to suppress an error message and undo
' changes.
Response = acDataErrContinue
End Sub