Form with timer is printed instead of report

  • Thread starter Thread starter hernan castro
  • Start date Start date
H

hernan castro

Hello, I have a form with a 40000 timer... the form is
the first form open.. its purpose is to check if it is
3:00 pm..so it closes the database for maintance, the
problem I have is sometimes when the user send a report
to print..the database prints the form instead of the
report.. the form is not modal nor pop-up... is there any
idea why the problem happens?

thanks

Hernan
 
I'm guessing that when the timer event fires, the form is the Active item
for a moment and the Print button on the toolbar prints the active item. Can
you create a form that will be hidden (Visible=False) and put the timer
event in this form? With the form hidden, it shouldn't become the active
item.
 
Yes, I seen this with reports that have a custom menu bar.

The select object command is needed to fix a "focus" problem if you have a
form with a timer function.

For the code that pops up the printer dialog (so the user can change
printers etc).

You can use:

On Error Resume Next
DoCmd.SelectObject acReport, Screen.ActiveReport.Name
DoCmd.RunCommand acCmdPrint

And, if your code does NOT need to bring up the printer dialog prompt box to
select a printer etc, then you can use:

On Error Resume Next
Dim strReportName as string
strREportName = Screen.ActiveReport.Name
DoCmd.SelectObject acReport, strReportName
DoCmd.PrintOut acPrintAll

So, likely you have a report open, and then have a custom button/menu to
print that report.

Both the above examples will fix this problem...
 
Believe it or not, even if the form has the visible = false..the print
problem occurs IF you have a custom menu for the report!

But, you are 100% bang on..that the timer event does cause some focus
change.

My code example in the other tread does fix this. (I also have a hidden form
with a timer to kick users out after a given time). I also experienced this
focus problem...


This is kind of, sort of a bug..but not really.... ;-)
 
Thanks Albert,

So, this doesn't happen if you use the Print button on the built-in toolbar
or the print command under the file menu, just with a custom toolbar?
 
Wayne Morgan said:
Thanks Albert,

So, this doesn't happen if you use the Print button on the built-in toolbar
or the print command under the file menu, just with a custom toolbar?

Yes..the above is actually my experience on this one, and posts in the
newsgroup confirm this. (it is the custom bar that seems to cause this).

It is possible that other cases exist, and have this problem (and, I bet the
code examples I used will also work/fix this problem).
 
Back
Top