Trap access messages that don't have numbers!

Bee

Registered User.
Local time
Today, 08:21
Joined
Aug 1, 2006
Messages
486
Hi

Any one knows how to trap access messages that don't display an error number such as the delete error:

Code:
Relationships that specify cascading deletes are about to cause 1 recod(s) in this table and in related tables to be deleted.

The message above does not display a number and when I pressed the help button, nothing at all was displayed on the help screen.

Any help will be very much appreciated.

Thanks,
B
 
They do have number, but are trapped differently.

Use form's OnError event to trap those.
 
Surely that's not an Error but a standard message?
 
Is that really an error message?

You can make yourself a function that replace or delete "0-9" characters in a string.

For example: msgbox(errorWithoutANumber(err.Description))
 
I apologize I did not word it properly, I did not mean it was an error message. Ok a standard message :)

I have tried the form's onError, but I don't know how to trap this particular message because I don't know its number. I wonder if you can provide an example please?
 
I have set warning to false then true as in the code below. I wonder if you can tell me if that's a good idea and can it have any potential problems in the future?


Code:
Private Sub cmdDelete_Click()
Dim answer As String
On Error GoTo Err_msg
    
    DoCmd.SetWarnings False
    answer = MsgBox("You are about to delete this Plot. You cannot undo this action." & vbCrLf & "Are you sure? If not, please press No to cancel", vbYesNo, "Delete")
    If answer = vbYes Then
        DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
        DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
    End If
    DoCmd.SetWarnings True

Exit_msg:
    Exit Sub

Err_msg:
    'MsgBox Err.Description
    Resume Exit_msg
End Sub

Thanks,
B
 

Users who are viewing this thread

Back
Top Bottom