Query broken link error

S

S.Clark

What's up MVPs?! Hope you're all doing well!

If I have a query with a broken link, when I open it from the db window, and
error message displays. Unable to display... blah blah...

But, if I open the query this way:

DoCmd.OpenQuery qdf.Name, acViewDesign

The error message doesn’t fire.

Any idea how to get/catch the error message to trigger from VBA code?

TIA,

Steve Clark
FMS, Inc.
 
M

Michel Walsh

Do you mean you use some object, which VBA knows as qdf, but whose ***name
property*** is to be used as argument of the DoCmd.OpenQuery? If so, are
you sure the object qdf.name is the same name as the query you use from the
db window?

Alternatively, is the query using a reference to a form, for one of its
parameter, form which is closed when using the db window and open when you
use the VBA line of DoCmd?


Can be something else too, evidently.


Vanderghast, Access MVP
 
S

S.Clark

I'm using For...Each to loop through every query name to open it in design
view. (Specifically to find any broken link errors) So, eventually, the name
in the qdf.Name will match.

You are correct that there is a parameter referencing a form in the query.
But, that form is NOT open when either open method is executed.
 
M

Michel Walsh

The form is NOT open, and one solution works, displaying some (valid) data?
I suspect some error handling is 'fixing' something it should not.


Vanderghast, Access MVP
 
Top