473,804 Members | 3,004 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PrintPreview messing with DetectIdleTime code ?

Hi all,
I am using the DetectIdleTime code from MS to shut down an app when not in use for a certain time.
http://support.microsoft.com/?kbid=210297

I use a hidden form FrmDetectIdeTim e with a timer event running the code.
But with some reports after having a printpreview on screen the form gets focus?
When I use code from a menubar like
DoCmd.PrintOut , , , , 2, False
DoCmd.Close
the form gets printed (only a tiny label 'idletime') instead of the report... and the form is closed.

On close of the reports I am asking if the report is printed indeed and restore the screen.with simple code like:
Private Sub Report_Close()
If MsgBox("Is this report printed indeed ?", vbExclamation + vbYesNo, TITEL) = vbYes Then
some updating here ...
End If
DoCmd.Restore
End Sub
Sometimes I see the form FrmDetectIdeTim e having focus, sometime not...

I am thinking the timer-code is messy, buggy or whatever?
I did read some comments about this timercode together with printpreviews.

Now I am considering to use my FrmDetectIdleTi me *only* when working with forms.
So close the form when reports are opened, reopen the form when forms getfocus.

Any thoughts?

Arno R

Mar 6 '06 #1
5 1608
On Mon, 6 Mar 2006 12:45:09 +0100, "Arno R" <ar***********@ tiscali.nl>
wrote:

MSFT's code is a bit sloppy because it does not use
Screen.ActiveRe port to check for reports. Just add that additional
logic.

-Tom.

Hi all,
I am using the DetectIdleTime code from MS to shut down an app when not in use for a certain time.
http://support.microsoft.com/?kbid=210297

I use a hidden form FrmDetectIdeTim e with a timer event running the code.
But with some reports after having a printpreview on screen the form gets focus?
When I use code from a menubar like
DoCmd.PrintO ut , , , , 2, False
DoCmd.Close
the form gets printed (only a tiny label 'idletime') instead of the report... and the form is closed.

On close of the reports I am asking if the report is printed indeed and restore the screen.with simple code like:
Private Sub Report_Close()
If MsgBox("Is this report printed indeed ?", vbExclamation + vbYesNo, TITEL) = vbYes Then
some updating here ...
End If
DoCmd.Restor e
End Sub
Sometimes I see the form FrmDetectIdeTim e having focus, sometime not...

I am thinking the timer-code is messy, buggy or whatever?
I did read some comments about this timercode together with printpreviews.

Now I am considering to use my FrmDetectIdleTi me *only* when working with forms.
So close the form when reports are opened, reopen the form when forms getfocus.

Any thoughts?

Arno R


Mar 6 '06 #2
Thanks Tom,
Just added code to check for Screen.ActiveRe port but I am still having the very same problem.
Problem pops up in a lesser frequency but still ....
Now I am considering to use my FrmDetectIdleTi me *only* when working with forms.
So close the form when reports are opened, reopen the form when forms getfocus.
Still considering this.

Arno R
"Tom van Stiphout" <no************ *@cox.net> schreef in bericht news:o2******** *************** *********@4ax.c om... On Mon, 6 Mar 2006 12:45:09 +0100, "Arno R" <ar***********@ tiscali.nl>
wrote:

MSFT's code is a bit sloppy because it does not use
Screen.ActiveRe port to check for reports. Just add that additional
logic.

-Tom.

Hi all,
I am using the DetectIdleTime code from MS to shut down an app when not in use for a certain time.
http://support.microsoft.com/?kbid=210297

I use a hidden form FrmDetectIdeTim e with a timer event running the code.
But with some reports after having a printpreview on screen the form gets focus?
When I use code from a menubar like
DoCmd.PrintOu t , , , , 2, False
DoCmd.Close
the form gets printed (only a tiny label 'idletime') instead of the report... and the form is closed.

On close of the reports I am asking if the report is printed indeed and restore the screen.with simple code like:
Private Sub Report_Close()
If MsgBox("Is this report printed indeed ?", vbExclamation + vbYesNo, TITEL) = vbYes Then
some updating here ...
End If
DoCmd.Resto re
End Sub
Sometimes I see the form FrmDetectIdeTim e having focus, sometime not...

I am thinking the timer-code is messy, buggy or whatever?
I did read some comments about this timercode together with printpreviews.

Now I am considering to use my FrmDetectIdleTi me *only* when working with forms.
So close the form when reports are opened, reopen the form when forms getfocus.

Any thoughts?

Arno R

Mar 6 '06 #3
The timer code silently forces the timer form to take focus
every time the timer event happens.

DoCmd.PrintOut is always gonna have trouble here, because it
prints the active object. As you have seen, if it prints
while the timer form is the active object, you get the timer
form instead of the report.

You need to stop the timer code before calling DoCmd.PrintOut.
You can start the timer again after calling docmd.printout.

And you should close the specific object, not just whatever
object happens to have focus:

DoCmd.Close acReport, Me.Name
(david)

"Arno R" <ar***********@ tiscali.nl> wrote in message
news:44******** **************@ text.nova.plane t.nl...
Hi all,
I am using the DetectIdleTime code from MS to shut down an app when not in
use for a certain time.
http://support.microsoft.com/?kbid=210297

I use a hidden form FrmDetectIdeTim e with a timer event running the code.
But with some reports after having a printpreview on screen the form gets
focus?
When I use code from a menubar like
DoCmd.PrintOut , , , , 2, False
DoCmd.Close
the form gets printed (only a tiny label 'idletime') instead of the
report... and the form is closed.

On close of the reports I am asking if the report is printed indeed and
restore the screen.with simple code like:
Private Sub Report_Close()
If MsgBox("Is this report printed indeed ?", vbExclamation + vbYesNo, TITEL)
= vbYes Then
some updating here ...
End If
DoCmd.Restore
End Sub
Sometimes I see the form FrmDetectIdeTim e having focus, sometime not...

I am thinking the timer-code is messy, buggy or whatever?
I did read some comments about this timercode together with printpreviews.

Now I am considering to use my FrmDetectIdleTi me *only* when working with
forms.
So close the form when reports are opened, reopen the form when forms
getfocus.

Any thoughts?

Arno R
Mar 7 '06 #4

"david epsom dot com dot au" <david@epsomdot comdotau> schreef in bericht news:44******** *************** @lon-reader.news.tel stra.net...
The timer code silently forces the timer form to take focus
every time the timer event happens.

DoCmd.PrintOut is always gonna have trouble here, because it
prints the active object. As you have seen, if it prints
while the timer form is the active object, you get the timer
form instead of the report.
I need to print two copies of some reports.
Is there another way to do this besides DoCmd.Printout?
You need to stop the timer code before calling DoCmd.PrintOut.
You can start the timer again after calling docmd.printout.
Yeh, thanks for this idea, but would it still be possible that the form still has focus at that time?

Maybe I might be better off to just close the form FrmDetectIdleTi me before any report is opened.
-- I could reopen the form on any form's activate event.
-- code: If not IsLoaded ("FrmDetectIdle Time") then DoCmd.OpenForm "FrmDetectIdleT ime", , , , , acHidden
And you should close the specific object, not just whatever
object happens to have focus:

DoCmd.Close acReport, Me.Name


I am using the printout-code from a menubar (which is loaded with reports only)
So I was thinking that the code DoCmd.Close would close the report that is currently loaded.
I am not calling the code from the report, so there is no Me.Name (am I missing something?)

Arno R
Mar 7 '06 #5
>I need to print two copies of some reports.
Is there another way to do this besides DoCmd.Printout?
Not that I know of (or, you could do OpenReport twice).

If you have code to do the printout, I would just add more
code there, rather than adding code to every form, but I'm
not prescriptive.

(david)


"Arno R" <ar***********@ tiscali.nl> wrote in message
news:44******** **************@ text.nova.plane t.nl...

"david epsom dot com dot au" <david@epsomdot comdotau> schreef in bericht
news:44******** *************** @lon-reader.news.tel stra.net... The timer code silently forces the timer form to take focus
every time the timer event happens.

DoCmd.PrintOut is always gonna have trouble here, because it
prints the active object. As you have seen, if it prints
while the timer form is the active object, you get the timer
form instead of the report.
I need to print two copies of some reports.
Is there another way to do this besides DoCmd.Printout?
You need to stop the timer code before calling DoCmd.PrintOut.
You can start the timer again after calling docmd.printout.
Yeh, thanks for this idea, but would it still be possible that the form
still has focus at that time?

Maybe I might be better off to just close the form FrmDetectIdleTi me before
any report is opened.
-- I could reopen the form on any form's activate event.
-- code: If not IsLoaded ("FrmDetectIdle Time") then DoCmd.OpenForm
"FrmDetectIdleT ime", , , , , acHidden
And you should close the specific object, not just whatever
object happens to have focus:

DoCmd.Close acReport, Me.Name


I am using the printout-code from a menubar (which is loaded with reports
only)
So I was thinking that the code DoCmd.Close would close the report that is
currently loaded.
I am not calling the code from the report, so there is no Me.Name (am I
missing something?)

Arno R
Mar 8 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2025
by: LARB | last post by:
Good morning, I have a print routine where I use a "printpreview dialog' control. The text is perfect BUT when I then print the job all the text is completely crazy, a bit like "wingdings".
1
2021
by: Randy | last post by:
Hello, I'm trying to print a simple string using the PrintPreviewDialog. I get the string to show up in the PrintPreview dialog, but when I click the Printer icon, it just prints a blank page. There's something I'm doing wrong. Can someone give me some code to print a simple string in the PrintPreview dialog box? Thanks
11
2368
by: Adam Right | last post by:
Hi, I am using .Net Framework 2.0 final, and i use .Net printing library to print a document. I use printPreview dialog to print the document but after preview was shown, when i press the "print" button, i cannot print the document although there is some words on the preview. So, is there a bug in the preview? Thanks...
9
3810
by: Adam Right | last post by:
Hi, I am using .Net Framework 2.0 final, and i use .Net printing library to print a document. I use printPreview dialog to print the document but after preview was shown, when i press the "print" button, i cannot print the document although there is some words on the preview. So, is there a bug in the preview? Thanks...
0
1006
by: james | last post by:
While trying to help another programmer on MSDN's Visual Basic 2005 Express Edition forum, he (and I ) ran into a strange problem with the PrintPreview Control in VB2005. If you load a document ( text file in this case) that has more than 12 pages ( I tried with a 50 page document too), instead of being able to see all 12+ pages in the Preview Window, all you see are Blank Pages!! But, preview a document with less than that, it will show...
0
1928
by: Joxie | last post by:
Hi, All! Recently I'm using ultrawebgrid for my projects... While I try Ultragrid (for windows application) I could call printpreview as ultragrid function, but while I'm using Ultrawebgrid (for asp.net/web application) I can't find the printpreview... So, the question is: Is there a way for me to use printpreview for Ultrawebgrid (just like when I'm using UltraGrid)? Note: 1. UltraGrid & UltraWebGrid are components from Infragistics.
6
1483
by: Stuart Nathan | last post by:
Can someone tell me how to remove a previously loaded PrintDocument in a PrintPreview control, so that I can display a nedw one?
2
2111
by: eBob.com | last post by:
I have a print application modeled on a program which I found via this newsgroup. (I still have comments in German in it!) The model uses ExtendedPrintPreviewDialog but I don't seem to have that so I am using PrintPreviewDialog. It prints fine. But the PrintPreview dialog shows only one blank page. Before I resort to posting code, is there some simple and/or common mistake I could have made which would explain why PrintPreview shows...
1
1516
by: abhishek Shrivastava | last post by:
Hi I want to make "PrintPreview" and "Print" my displayed form to Pdf. i am using Ms_Access for Coding. I have taken Two Button for That but I dont Know code i should Use. Pls Help. Platgform: Windows Xp code using : MS_ACCESS abhishek BOMBAY INDIA
0
9577
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10569
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10325
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10315
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4295
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.