Close a query on error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a query that depends on a form being open. If the query is
inadvertently opened without the form being open an error is generated but
it's not possible to close the query - it gets stuck in a loop of displaying
the error message and then going to debug.

Is there a way of forcing the query to close in the event of an error?

Thanks
 
Can you tell us more about this?

If the query refers to a control on a form that is not open, such as:
[Forms].[Form1].[Text0]
it should not generate an error. It should pop up a parameter box asking for
the value to use for each reference. You can't prevent that.

If that's not the issue, please provide more detail.
Is it a crosstab?
A query that has another query as a source table?
 
Allen

Thanks - it's not a major problem - it only occurs whilst I'm developing the
database so I'll just remember to open the form

Regards

Allen Browne said:
Can you tell us more about this?

If the query refers to a control on a form that is not open, such as:
[Forms].[Form1].[Text0]
it should not generate an error. It should pop up a parameter box asking for
the value to use for each reference. You can't prevent that.

If that's not the issue, please provide more detail.
Is it a crosstab?
A query that has another query as a source table?

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Snowsride said:
I have a query that depends on a form being open. If the query is
inadvertently opened without the form being open an error is generated but
it's not possible to close the query - it gets stuck in a loop of
displaying
the error message and then going to debug.

Is there a way of forcing the query to close in the event of an error?

Thanks
 
Okay, so it is the series of parameter dialogs you are referring to.

I find them really annoying to, so I very rarely design queries with
parameters like that. Instead, I apply a filter to a form, a WhereCondition
to a report, or build the whole query statement for code or RecordSource.

If that sounds useful, there is a simple example of building the
WhereCondition for a report in this link:
Print the record in the form
at:
http://allenbrowne.com/casu-15.html
or in Method 2 of this link:
Limiting a Report to a Date Range
at:
http://allenbrowne.com/casu-08.html

Or there is a more comprehensive example of how to build the filter string
in this link:
Search form - Handle many optional criteria
at:
http://allenbrowne.com/ser-62.html

Hope that helps.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Snowsride said:
Allen

Thanks - it's not a major problem - it only occurs whilst I'm developing
the
database so I'll just remember to open the form

Regards

Allen Browne said:
Can you tell us more about this?

If the query refers to a control on a form that is not open, such as:
[Forms].[Form1].[Text0]
it should not generate an error. It should pop up a parameter box asking
for
the value to use for each reference. You can't prevent that.

If that's not the issue, please provide more detail.
Is it a crosstab?
A query that has another query as a source table?

Snowsride said:
I have a query that depends on a form being open. If the query is
inadvertently opened without the form being open an error is generated
but
it's not possible to close the query - it gets stuck in a loop of
displaying
the error message and then going to debug.

Is there a way of forcing the query to close in the event of an error?
 
Back
Top