acViewPreview

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

Guest

I have an application that has a command button that opens a query in preview
mode.

DoCmd.OpenQuery "myquery", acViewPreview

This works just fine, but when I click the close button on the preview
window, only the preview window closes. Is there a way to make the query
close at the same time?

Thanks in advance!

Dwight
 
I have an application that has a command button that opens a query in preview
mode.

DoCmd.OpenQuery "myquery", acViewPreview

This works just fine, but when I click the close button on the preview
window, only the preview window closes. Is there a way to make the query
close at the same time?

Thanks in advance!

Dwight

When you open a query in acViewPreview, you are actually getting a
report view of the query, not the query datasheet itself.
Therefore you need to close the report and then close the query behind
it.
Queries are not really designed to be printed or previewed. If you
want to print out the query, create a report using the query as it's
record source. Print or preview that report. The query will not even
be opened.

DoCmd.OpenQuery "myquery"
will open and display just the query in datasheet view if that's what
you want.
 

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

Back
Top