Hide Query in while running

  • Thread starter pib311 via AccessMonster.com
  • Start date
P

pib311 via AccessMonster.com

Hi all.

I have an issue with a database that will be used by people that do not like
change and do not want to see things that don't make sense to them. So basic
users.

I am using the following code to open a query, copy all records, and paste
the results into a template in excel.

'Prepare database for current weeks Data
DoCmd.OpenQuery rst!query_name
DoCmd.RunCommand acCmdSelectAllRecords
DoCmd.RunCommand acCmdCopy

xlws.Range(rst!Range).PasteSpecial xlPasteValues

DoCmd.SetWarnings False
DoCmd.Close acQuery, rst!query_name, acSaveNo
DoCmd.SetWarnings True

Everything works great, the data is copied into Excel. The only issue is
that when the query opens and copies all records, you can see the open query.
Is there a way to open this to copy the records and paste the value in an
open excel template without them seeing the query run? This loops through a
few queries to create the final report.

Please assist. Thanks in advance.
 
S

Stuart McCall

pib311 via AccessMonster.com said:
Hi all.

I have an issue with a database that will be used by people that do not
like
change and do not want to see things that don't make sense to them. So
basic
users.

I am using the following code to open a query, copy all records, and paste
the results into a template in excel.

'Prepare database for current weeks Data
DoCmd.OpenQuery rst!query_name
DoCmd.RunCommand acCmdSelectAllRecords
DoCmd.RunCommand acCmdCopy

xlws.Range(rst!Range).PasteSpecial xlPasteValues

DoCmd.SetWarnings False
DoCmd.Close acQuery, rst!query_name, acSaveNo
DoCmd.SetWarnings True

Everything works great, the data is copied into Excel. The only issue is
that when the query opens and copies all records, you can see the open
query.
Is there a way to open this to copy the records and paste the value in an
open excel template without them seeing the query run? This loops through
a
few queries to create the final report.

Please assist. Thanks in advance.

Application.Echo False
DoCmd.OpenQuery rst!query_name
....
Application.Echo True

While Application.Echo is False, Access will not perform screen updates. If
there's an error handler present, you MUST include the last line above, or
your app will appear to 'freeze'.
 
P

pib311 via AccessMonster.com

Sorry for the late reply, I have been out of the office.

The answer was perfect for what I needed. Thanks for the assistance.

Stuart said:
[quoted text clipped - 27 lines]
Please assist. Thanks in advance.

Application.Echo False
DoCmd.OpenQuery rst!query_name
...
Application.Echo True

While Application.Echo is False, Access will not perform screen updates. If
there's an error handler present, you MUST include the last line above, or
your app will appear to 'freeze'.
 

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