Default Access Errors

  • Thread starter Thread starter Bradley C. Hammerstrom
  • Start date Start date
B

Bradley C. Hammerstrom

A2K,

My form has an image frame. The user can pick and save the image to be
loaded into the frame. The path and filename are stored in a table (it's
always a path to a photo CD).

If the user tries to open the form when the CD is not loaded, I want the
error to be handled with a dialog, "Please insert CD". Instead, the user
sees a default error dialog from Access about how it can't find the path,
which is a bit technical for the user.

Q: How can I override, or pre-empt, the standard default Access error dialog
and use my own in it's place?

Brad H.
 
You could turn off the standard warnings with code
SetWarnings = False
then use a custom message box to show your own text
msgbox "Please insert CD..."

-Ed
 
But where to insert the code; in which procedure--Form_OnLoad? OnError?
OnOpen? I've tried these.

Maybe I'm putting the line in the wrong spot. Before the OnError statement,
or after?

Brad H.
 
Well you propably want to use an event tied to the image control, not the
whole form. The "BeforeUpdate" is a good place to start. Are your users
selecting the control source of a bound image control on your form? If so,
why not provide a list or combo box of available images for them to pick
from? You could also set validation limits on the image control and provide
a message when validation fails.
-Ed
 
Ed.

Ah, here's the problem--the image control has no events. So where can I trap
the error?
I've tried the On Error event for the form. I've tried the OnLoad and OnOpen
events for the form, all to no avail. The default Access error occurs before
all of these events, apparantly. . .

Brad H.
 
Back
Top