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

  • Thread starter Thread starter Seddon Acaster
  • Start date Start date
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
 
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.
 
Back
Top