How do you close a query as well as a form?

S

Seddon Acaster

When a form opens it also opens a query. When you close
the form by clicking on the X in the title bar I want the
query to close as well.

How do I do this?

Seddon
 
J

John Vinson

When a form opens it also opens a query. When you close
the form by clicking on the X in the title bar I want the
query to close as well.

Why does the Form open the query at all? This is NOT normal behavior;
typically one would simply set the Form's Recordsource property to the
name of the query, and only open the Form. Are you doing something
specific to open the query datasheet as well?

If there's a good reason which I can't see for opening the query
datasheet in the first place, then you can put code in the Form's
Close event like

DoCmd.Close acQuery, "queryname"

to close it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top