"On Not in List" event

  • Thread starter Thread starter amyc7393
  • Start date Start date
A

amyc7393

Guest
Does anyone know how to disable the default Access warning for the "On Not in List" event? I'm referring to the message box that pops up when you try to enter an item that is not in the list, and the Limit to List property has been set to Yes. I have created my own customized message box (via macro), but now I'm getting both the default message and my message. I have very little experience with code, but I think I've exhausted all my point-and-click options, and I still can't figure out how to do it. I was hoping someone could walk me through the code. Thanks!
 
This works for me...

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strMsg As String

strMsg = "The item you entered is not in the available list."

If MsgBox(strMsg, vbQuestion + vbYesNo, "Add New?") = vbNo Then
Response = acDataErrContinue
Screen.ActiveControl = ""
Else
Set db = CurrentDb

Set rs = db.OpenRecordset("tblPeople", dbOpenDynaset)
On Error Resume Next

rs.AddNew
rs!PeopleType = NewRecord
rs.Update

If Err Then
MsgBox "An error occurred. Please try again."
Set rs = Nothing
Response = acDataErrContinue
Else
Response = acDataErrAdded
End If

End If

Set db = Nothing
Set rs = Nothing
 
Thanks so much! I can't wait to try this.
 

Users who are viewing this thread

Back
Top Bottom