Unanswered: Can't follow the hyperlink - ignore messagebox
I'm in need of a little help of the access guru's out there. This is the situtation. I have a little switchboard which uses labels that functions as hyperlinks to other forms in my access application. Now, on some occations these forms may not be opened by the user. Therefore I've written some code in the open event of the forms in question. If some conditions are met, I display a messagebox and finish by cancelling the opening of the form. Now this causes access to trigger an "MS Access can't follow the hyperlink" error and with it, it displays an Access native messagebox. Obviously, I don't want this messagebox because I allready informed the user why he/she can't open the form. How do I prevent Access to open this messagebox, or how do I avoid the opening of it?
Indeed. The 'cancel=true' line is inside the target form (in the on open event). Is it possible then to do some checking of the target form before following the hyperlink to that form? If that is the case then my problem is solved of course.
What criteria are you evaluating in the on open event that isn't present BEFORE you open the form?
If you were to move these criteria checks to the "calling" form, and only execute the DoCmd.OpenForm method AFTER all the criteria has been checked out, then you simply never open the form to begin with.
yes of course, but this would imply the use of the docmd.openform method. I'm using here a label with the hyperlink propery set to a form in my application. The reasen therefore is that with hyperlinks the mouse icon is automatically changed to a hand, which gives a good indication to the user. So I can't use the docmd.openform method here because I think that the following of the hyperlink occurs before the click event of the label in question.
well, this is a bit of a hack, but you could keep the hyperlink property set to true (along with your helptips and so forth), but leave the hyperlink itself blank, and instead use the on click event to do the actual navigation? This would give you the desired "mouse-over" effect, coloring, etc while giving you better control over the event handling.