Results 1 to 5 of 5

Thread: error 2501

  1. #1
    Join Date
    Oct 2002
    Location
    Arkansas
    Posts
    9

    Unanswered: error 2501

    What do I need to add to this code to prevent the error handling from also suppressing the msg that i DO want to appear (msgbox "please...)


    Private Sub Form_Unload(Cancel As Integer)
    On Error GoTo ErrorHandler

    If Me.Text86 = "J" And IsNull(cboDA.Column(1)) Then
    MsgBox "Please Enter The Juvenile's Current Dorm Assignment, or select 'Unknown'."

    Me.cboDA.SetFocus
    Cancel = True
    End If

    ErrorHandler:

    If Err.Number = 2501 Then
    Resume Next

    Exit Sub

    End If

    End Sub

  2. #2
    Join Date
    Jul 2002
    Posts
    36
    if you don't care what the error is, replace On Error GoTo ErrorHandler with On Error Resume Next.

    Jim

  3. #3
    Join Date
    Oct 2002
    Location
    Arkansas
    Posts
    9
    i do care.. i want: MsgBox "Please Enter The Juvenile's Current Dorm Assignment, or select 'Unknown'." to show, but not the Access generated msg "The Close action was cancelled." that follows.

  4. #4
    Join Date
    Jul 2002
    Posts
    36
    ok, I hope I'm not steering down the wrong path, but here's another thing to try:

    docmd.setwarnings false
    Cancel = true
    docmd.setwarnings true

    This should toggle off Access msgs while you cancel the event and then toggle them back on. Good luck.

    Jim

  5. #5
    Join Date
    Jul 2002
    Posts
    36
    just tried it--it didn't work. sorry.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •