How to supress Access messages and using own messages

S

Smiley

Good afternoon,

Would someone tell me how to supressed message from Access but give a
message of my own words. I know there is a setting in Tools --> Options -->
tab Edit/Find, there is a section which headed Confirm. I know I would
unticked those boxes which will not give me the message. But this is only
partial of what I want, I want to give a more meaningful message to users
and not the default message from Acess. Anyway this would be done ?

Many thanks in advance.

Smiley
 
K

Klatuu

It depends on which messages your are referring to. Warning messsages on
file and record operations can be suppressed by setting the options under
Tools, Options, Edit/Find tab. There are 3 check boxes in the Confirm
section that control these messages.

If it is error messages, then those have to be handled with your own error
handling code.
 
S

Smiley

Hi Dave,

Thank you for the info.

I still would like to know how would I find out which message popped up and
I would 'pop' my own message. For example, if I suppressed the warning
message that 2 records are to be deleted. How do I know (in coding) that the
message is a confirmation of deleting record and not information message,
say record not found.

Another query is where do I find the error codes from MSAccess and handled
it in the coding. for example, if the error is can't find a function. When
this happened, I would like to pop up a message to say that function xxx is
not found rather then error code which means nothing to most user.

Smiley
 
K

Klatuu

I don't know if there is a printed list of all the possible Access errors.
What I usually do if I don't know what to expect is to allow the error to
occur in testing, then write my own message. Here is an example of an error
handling routine. In this example, I don't care if error 2501 occurs, so I
don't even show it as an error.

PrintReport_Exit:

On Error Resume Next

Set qdf = Nothing
Set qdfXl = Nothing
Set qdfs = Nothing
Set dbf = Nothing

Exit Sub

PrintReport_Error:

If Err.Number <> 2501 Then
MsgBox "Error " & Err.Number & " (" & Err.Description & _
") in procedure PrintReport of VBA Document Form_frmBPOReports"
End If
GoTo PrintReport_Exit

End Sub

If you want to display your own meaningful message then you use the msgbox
to display it to the user:

FindFieldName_Error:

If Err.Number = 3265 Then
MsgBox "Table " & strTblName & " Not Found"
Else
MsgBox "Error " & Err.Number & " (" & Err.Description & _
") in procedure FindFieldName of Module modUtilities"
End If
GoTo FindFieldName_Exit
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top