UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Timer Closing A Report In Print Preview, Access 2010    
 
   
stevep
post Dec 16 2017, 06:25 PM
Post#1



Posts: 69
Joined: 9-November 14



I have a user who leaves a report up in Print Preview, and he goes home. This interferes with some data refreshes that occur over night.

I found that I can put in a simple line of code in the Report Timer event like

docmd.close acReport, Me.Name

which works great in Normal view. But I see that it does not fire when in Print Preview.

Is there a way to autoclose a report after say 30 minutes while in Print Preview?
Go to the top of the page
 
Doug Steele
post Dec 16 2017, 07:40 PM
Post#2


UtterAccess VIP
Posts: 21,811
Joined: 8-January 07
From: St. Catharines, ON (Canada)


Wouldn't it be preferable to log the user off after inactivity?

See How to Detect User Idle Time or Inactivity for one possibility. (Don't worry that it says Access 2000: it applies to all versions)

--------------------
Doug Steele, Microsoft Access MVP (2000-2018)
http://www.accessmvp.com/DJSteele/AccessIndex.html
Co-author: Access Solutions: Tips, Tricks, and Secrets from Microsoft Access MVPs, published by Wiley
Co-author: Effective SQL: 61 Specific Ways to Write Better SQL, published by Addison-Wesley Professional
Technical Editor: Access 2010 Bible, Access 2013 Bible, Access 2016 Bible, all published by Wiley
Technical Editor: SQL Queries for Mere Mortals: A Hands-On Guide to Data Manipulation in SQL, 4th Edition, published by Addison-Wesley Professional
Go to the top of the page
 
RJD
post Dec 16 2017, 07:52 PM
Post#3


UtterAccess VIP
Posts: 8,487
Joined: 25-October 10
From: Gulf South USA


Hi: Here is a way to use a timer when you preview the report from a command on a form. The demo is set for 10 seconds, then closes the preview. You, of course, can set the timer to whatever you want (this one in seconds).

HTH
Joe
Attached File(s)
Attached File  CloseReportWithTimer.zip ( 24.96K )Number of downloads: 9
 

--------------------
"Each problem that I solved became a rule, which served afterwards to solve other problems."
"You just keep pushing. You just keep pushing. I made every mistake that could be made. But I just kept pushing."

Rene Descartes 1596-1650 (Mathematician and Philosopher)
Go to the top of the page
 
stevep
post Dec 17 2017, 03:46 AM
Post#4



Posts: 69
Joined: 9-November 14



Thanks for the rapid response. Both of these are better than the status quo so I will use them.

A bit of background. This report (Product Status report with inventory, sales history, purchase history, ... a bunch of stuff) is opened at least 30 times per day. Or over 100 times when we are actually running the ordering cycle.

The primary user is the owner of the company who uses it to see stock availability and margin data. He will often open it, spot something interesting, walk to the warehouse to ask about it, leaving the report open on his desktop. Other users run the same report but less frequently and from other sources (other forms or databases). Logging those other users off is attractive for reasons besides this one report.

In order to speed performance, I have a sub that runs overnight to grab all the data and put a snapshot for use in this and other reports. This is done by leaving the database running on the owners computer 24/7 and having a timer event fire around 1am. The sub takes about 30 minutes to do all its stuff.

There are probably many things I can do to speed performance but I am probably stuck with the overnight sub which does many other tasks like extractions to Excel and setting up data sharing with regional warehouses through Dropbox. This sub fails when he leaves the report open because it cant take a snapshot while the file is in use.

So, besides deploying what I have learned here, I will still seek something that I can embed in the report itself to be independent of how it is launched. I am thinking of putting that Pause function (thanks) in the report Open event, and set it to close after 30 minutes unless the user closes it anyway.
Go to the top of the page
 
RJD
post Dec 17 2017, 11:55 AM
Post#5


UtterAccess VIP
Posts: 8,487
Joined: 25-October 10
From: Gulf South USA


Hi Steve ...

QUOTE
I will still seek something that I can embed in the report itself to be independent of how it is launched

I would be very happy to be corrected on this, but I do not know a way to execute the code you want (delay and close) from within a report event. It would have to be executed AFTER the report has finished loading/previewing, and I don't see an event to do that.

My demo used code behind a form command button (as you saw) to open the report, then pause, then close the report. These events exist outside the report itself, not within any report event.

How does a user preview a report now? I would think you would want to set up your front-end as an ACCDE, with the navigation panel hidden, and have the user open a report ONLY by the use of a form command button. This way you can control the display time effectively.

Just some thoughts ...

HTH
Joe

--------------------
"Each problem that I solved became a rule, which served afterwards to solve other problems."
"You just keep pushing. You just keep pushing. I made every mistake that could be made. But I just kept pushing."

Rene Descartes 1596-1650 (Mathematician and Philosopher)
Go to the top of the page
 
RJD
post Dec 17 2017, 12:02 PM
Post#6


UtterAccess VIP
Posts: 8,487
Joined: 25-October 10
From: Gulf South USA


Oh, and another thing ...

QUOTE
In order to speed performance, I have a sub that runs overnight to grab all the data and put a snapshot for use in this and other reports. This is done by leaving the database running on the owners computer 24/7 and having a timer event fire around 1am.

You need not leave the owner's database running to do this. You could have a separate db running that just does the update. After all, the tables should be separate from the user's (owner's) frontend, in a common backend, so the owner's frontend is not necessary for updating.

You could even use Windows to activate a schedule procedure at the chosen time with the Task Scheduler, using a utility Access frontend, and run a procedure in the utility frontend to perform the update.

HTH
Joe

--------------------
"Each problem that I solved became a rule, which served afterwards to solve other problems."
"You just keep pushing. You just keep pushing. I made every mistake that could be made. But I just kept pushing."

Rene Descartes 1596-1650 (Mathematician and Philosopher)
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    19th July 2018 - 08:25 PM