Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do we bypass Access default message box?

Status
Not open for further replies.

LeiDBug007

Technical User
Oct 15, 2003
33
US
Greetings!

I know it's something really simple but we seem to be drawing a blank......?

You know how Access has their own default gray message boxes when certain functions are done.....

Well.... we've got a field that we marked as "Required" in the tables properties so that the user cannot leave that field until they do some data entry. However, we want our own customized message to pop-up instead of that long & user-'UN'friendly MS Access message box that pops up. We want our own message that says they cannot leave the system unless they enter some notes in that field.

Do we need to set-up a macro? Can we just put something in the Validation Rule & Validation Text? Can we just add it in our VB code maybe?

I know it's something simple & we've done it before.... but I've got a "brain fart"! Can't seem to lock in the route on how to bypass Access' message box.

Here's a piece of our form's code, but our message box won't pop....
----------------------------------------------------
Private Sub Notes_Enter()
If IsNull(Me.ntNotes.Value) Then
Me.ntNotes.Locked = False
'MsgBox "You must enter notes before exiting the system!"
RetValue = MsgBox("You must enter notes before exiting the system!", vbOK)
End If
End Sub
----------------------------------------------------
YOUR EXPERTISE IS DESPERATELY NEEDED!!!! Thanx so much!
 
Hi!

This is probably a form error, which might be trapped by using the on error event of the form. Below is an example of that only bypassing the errormessage and using your own custom message if the form error 3314 occurs (I believe that might be the error you're receiving)

[tt]private sub form_error(dataerr as integer, response as integer)
if dataerr=3314 then
msgbox "You must..."
response = acdataerrcontinue
end if
end sub[/tt]

If this is not the error, try using a

[tt]msgbox dataerr[/tt]

at the top of the routine to get the correct dataerr number to check for.

DataErr is the form error number
Response is used to tell access what to do - acdataerrcontinue means continue without displaying default message.

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top