suppress system messages

Rachael

Registered User.
Local time
Today, 10:45
Joined
Nov 2, 2000
Messages
205
Hi All,

I have designed a db that I plan to distribute, many of my clients are basicly computer illiterate. The situation is that where I have a field on a form for data entry set to a number field, thats OK, but if the client (for some reason) tries to enter text into this field they will get a system message about invalid entry etc etc which for the client will be extremely perplexing. How do I turn these off and add my own message?

I have read lots about DoCmd.SetWarnings False but if there is no code attached to the field how can I incorporate this.

I hope this makes sense.

Thanks in advance

Rachael
 
The first thing you will need to do is identify the "error number" that access names this type of error as. Do this in the Debug Immediate window. Write the following into your Code. Debug.Print "DataErr = "; DataErr. Cause the error to occur and the number associated with that type of error will appear in the debug window.

Now that you have the number, you can write code such as this:

Private Sub Form_Error (DataErr As Integer, Response As Integer)

Const conErrField = 1234

If DataErr = ConErrField Then
DisplayMessage "You have entered text into a numeric field!"
Response = acDataErrContinue
Else
Response = acDataErrDisplay
End If
End Sub

As for the warnings, the code is

DoCmd.Setwarnings (False) -- to turn off
DoCmd.Setwarnings (True) -- to turn back on


You don't need to alter the warnings using the code above. The warnings settings work well for when you are running outputs and update queries that "scare" the user when they read "you are about to modify data...."

Hope that helps.
 
Thanks heaps for your reply, please excuse my dumbness here, I understand what you are saying and the code etc etc, but where exactly do I put the code, do I simply go to the form with the message I want to suppress and then go to the VB window and type in your code suggestion?

In the past i have only entered code from the properties sheet [Event procedure] area or a wizard has written the code for me.

Sorry for my lack of knowledge here.

Thankyou, Rachael
 
Hope I am not interfering here. Rachael, place the code in the On Error event for the form in question.
 
Hope I am not interfering here. Rachael, place the code in the On Error event for the form in question.
 
Thanks DJN and no, your not interferring at all, as you would know any help is greatly appreciated. I shall combine your's and jwindon's replies and see how I go.

Thankyou, Thankyou, Thankyou, Thankyou, Thankyou, Thankyou, Thankyou, Thankyou, Thankyou, Thankyou, Thankyou, Thankyou, Thankyou, Thankyou, Thankyou, Thankyou, Thankyou.

Rachael
 

Users who are viewing this thread

Back
Top Bottom