dbTalk Databases Forums  

Hiding a report while printing ACC 2003

comp.databases.ms-access comp.databases.ms-access


Discuss Hiding a report while printing ACC 2003 in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
brian.flannery@ci.verona.wi.us
 
Posts: n/a

Default Hiding a report while printing ACC 2003 - 03-27-2009 , 11:37 AM






I'm trying to "hide" a report while printing. I need to open the
report in preview mode as so to count the pages (if multiple so I can
set the printer to duplex printing) and then print the number of
copies collected via input box. I've tried every combination I can
think of to suppress the report "popping up" and then going away.
Here's an example of what I'm doing.

stDocName = "rptMyReport"

intCopies = InputBox("Enter the number of copies to print", "Copies",
1, 5000, 4000)

DoCmd.OpenReport stDocName, acViewPreview, "", "My Filter"


'Check to see the number of pages. If it is greater than 1, the
printer is set to duplex printing

If Reports!rptMyReport.Pages > 1 Then

Set prtFirst = Application.Printers(0)

With Reports(stDocName).Printer

.Duplex = acPRDPVertical

End With

DoCmd.PrintOut acPrintAll, , , acHigh, intCopies, False

With Reports(stDocName).Printer

.Duplex = acPRDPSimplex

End With

DoCmd.Close acReport, stDocName, acSaveNo


Else
DoCmd.OpenReport stDocName, acViewPreview, "", "My Filter"

DoCmd.PrintOut acPrintAll, , , acHigh, intCopies, False

DoCmd.Close acReport, stDocName, acSaveNo

End If

stDocName = ""


Exit Sub

'Error Handler

Error_Handler:

MsgBox err.Description

DoCmd.CancelEvent


Any suggestions would be greatly appreciated. I don't have much
hair left. :-)

Reply With Quote
  #2  
Old   
MGFoster
 
Posts: n/a

Default Re: Hiding a report while printing ACC 2003 - 03-27-2009 , 12:10 PM






brian.flannery (AT) ci (DOT) verona.wi.us wrote:
Quote:
I'm trying to "hide" a report while printing. I need to open the
report in preview mode as so to count the pages (if multiple so I can
set the printer to duplex printing) and then print the number of
copies collected via input box. I've tried every combination I can
think of to suppress the report "popping up" and then going away.
Here's an example of what I'm doing.

stDocName = "rptMyReport"

intCopies = InputBox("Enter the number of copies to print", "Copies",
1, 5000, 4000)

DoCmd.OpenReport stDocName, acViewPreview, "", "My Filter"

SNIP

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

In the above line you have "My Filter" in the WhereCondition parameter
position.

To hide the report use the WindowMode:=acHidden in the OpenReport
method.

You don't need empty strings ("") when you don't use a parameter, just
include the comma:

DoCmd.OpenReport stDocName, acViewPreview, "My Filter", , acHidden

Or you can use Named Parameters:

DoCmd.OpenReport stDocName, View:=acViewPreview,
FilterName:="My Filter", WindowMode:=acHidden

HTH,
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSc0Wf4echKqOuFEgEQIgswCeIq9PvZQ+N9pSalHWvJNCYd mQfwQAnRmA
BZoeeGiwuzSwb459PeGGs6Ei
=u/JD
-----END PGP SIGNATURE-----


Reply With Quote
  #3  
Old   
Salad
 
Posts: n/a

Default Re: Hiding a report while printing ACC 2003 - 03-27-2009 , 12:54 PM



brian.flannery (AT) ci (DOT) verona.wi.us wrote:
Quote:
I'm trying to "hide" a report while printing. I need to open the
report in preview mode as so to count the pages (if multiple so I can
set the printer to duplex printing) and then print the number of
copies collected via input box. I've tried every combination I can
think of to suppress the report "popping up" and then going away.
Here's an example of what I'm doing.

stDocName = "rptMyReport"

intCopies = InputBox("Enter the number of copies to print", "Copies",
1, 5000, 4000)

DoCmd.OpenReport stDocName, acViewPreview, "", "My Filter"


'Check to see the number of pages. If it is greater than 1, the
printer is set to duplex printing

If Reports!rptMyReport.Pages > 1 Then

Set prtFirst = Application.Printers(0)

With Reports(stDocName).Printer

.Duplex = acPRDPVertical

End With

DoCmd.PrintOut acPrintAll, , , acHigh, intCopies, False

With Reports(stDocName).Printer

.Duplex = acPRDPSimplex

End With

DoCmd.Close acReport, stDocName, acSaveNo


Else
DoCmd.OpenReport stDocName, acViewPreview, "", "My Filter"

DoCmd.PrintOut acPrintAll, , , acHigh, intCopies, False

DoCmd.Close acReport, stDocName, acSaveNo

End If

stDocName = ""


Exit Sub

'Error Handler

Error_Handler:

MsgBox err.Description

DoCmd.CancelEvent


Any suggestions would be greatly appreciated. I don't have much
hair left. :-)
MG Fosters is beneficial when opening a report. I suppose if the report
is open, the property you can experiment with is Visible to hide it.
Me.Visible = False
Me.Visible = True

Since reports print quickly, I'm not sure why you want to Hide the
report. I think this would cause some flicker or maybe confusion as it
becomes visible and invisible. Maybe the hourglass would work just as well.
Docmd.Hourglass True
Docmd.Hourglass False
and this would show there's an action occurring while the housglass is
visible. Just a thought.




Reply With Quote
  #4  
Old   
brian.flannery@ci.verona.wi.us
 
Posts: n/a

Default Re: Hiding a report while printing ACC 2003 - 03-28-2009 , 12:18 AM



On Mar 27, 1:54*pm, Salad <o... (AT) vinegar (DOT) com> wrote:
Quote:
brian.flann... (AT) ci (DOT) verona.wi.us wrote:
I'm trying to "hide" a report while printing. *I need to open the
report in preview mode as so to count the pages (if multiple so I can
set the printer to duplex printing) and then print the number of
copies collected via input box. *I've tried every combination I can
think of to suppress the report "popping up" and then going away.
Here's an example of what I'm doing.

stDocName = "rptMyReport"

intCopies = InputBox("Enter the number of copies to print", "Copies",
1, 5000, 4000)

DoCmd.OpenReport stDocName, acViewPreview, "", "My Filter"

* 'Check to see the number of pages. *If it is greater than 1, the
printer is set to duplex printing

* If Reports!rptMyReport.Pages > 1 Then

* * Set prtFirst = Application.Printers(0)

* * With Reports(stDocName).Printer

* * * * .Duplex = acPRDPVertical

* * End With

* * DoCmd.PrintOut acPrintAll, , , acHigh, intCopies, False

* * With Reports(stDocName).Printer

* * * * .Duplex = acPRDPSimplex

* * End With

* * DoCmd.Close acReport, stDocName, acSaveNo

Else
* * DoCmd.OpenReport stDocName, acViewPreview, "", "My Filter"

* * DoCmd.PrintOut acPrintAll, , , acHigh, intCopies, False

* * DoCmd.Close acReport, stDocName, acSaveNo

End If

* stDocName = ""

Exit Sub

* * 'Error Handler

Error_Handler:

* * MsgBox err.Description

* * DoCmd.CancelEvent

* Any suggestions would be greatly appreciated. *I don't have much
hair left. *:-)

MG Fosters is beneficial when opening a report. *I suppose if the report
is open, the property you can experiment with is Visible to hide it.
* * * * Me.Visible = False
* * * * Me.Visible = True

Since reports print quickly, I'm not sure why you want to Hide the
report. *I think this would cause some flicker or maybe confusion as it
becomes visible and invisible. *Maybe the hourglass would work just as well.
* * * * Docmd.Hourglass True
* * * * Docmd.Hourglass False
and this would show there's an action occurring while the housglass is
visible. *Just a thought.
I've tried several different combinations using "acHidden" as well as
"Me.Visible" and even have gone so far as trying "Echo". The only way
everything seems to work properly is the way I have posted. Other
combinations either don't print right (i.e. number of copies), or
don't filter at all (the Where Condition) or don't set the printer
properly.

I'll be the first to admit that the db in question probably isn't the
most efficient or even properly laid out. I'm sure the design of the
form which is open while all of this takes place is mostly to blame.
I'm not a professional developer. Most of my "real" db design
education has been through trial and error, or by reading and applying
the vast knowledge of the many wonderful posters within this
group.

That being said, what may be making this problem more significant is
the fact that we are using Shrinker Stretcher to enlarge the view.
The db was originally designed based on the screen resolution of a 15"
laptop and is now being viewed by three users on 22" monitors. The
dynamic SS utility seems to slow down the screen reaction time which
I'm sure is mostly because the main user form is pretty "busy". Like
I said, it's probably a poor design, but the main user form is a form,
with a tab control and twelve subforms. I don't know what the magic
number of subforms should be, but good or bad, it's really efficient
for the way we do business. We rely on going to one record within the
form and then switching to related information on the various
subforms- and back and forth between the tabs. It's a municipal
permit db. So we go to a permit, and then tab from contractors to
fees, inspections, pictures, etc. I've thought about switching to pop
up forms but I think it would become too cumbersome having to
continually open and close forms all the time. Anyway, back to the
question at hand...

When the user opts to print the report, the report "flashes" but then
the screen hangs while (I'm assuming) it needs to repaint itself which
takes what seems like an eternity and from a purely visual standpoint,
looks like crap. I've got to believe that there is a simple way that
I'm overlooking that would "force" the report to do it's thing behind
the form and out of sight.

Well, I've bared my soul for both ridicule and help. Thanks for
letting me ramble on. Again, any thoughts, suggestions and direction
would be appreciated. Thanks again.


Reply With Quote
  #5  
Old   
tina
 
Posts: n/a

Default Re: Hiding a report while printing ACC 2003 - 03-28-2009 , 09:05 AM



well, my first question would be: why not just set the printer to duplex
printing each time the report prints? even if the printer isn't smart enough
to recognize one page as opposed to many, wouldn't treating a single-page
report the same as a two-page report cause only a negligible increase in
printing time as that one page is flipped and run through the printer a
second time? i've never used a duplex printer in any capacity, so i don't
know if that's a reasonable assumption - but if you don't know either, then
it's worth testing, i think.

regarding the mainform with 12 subforms on tab pages: i used to use the
same kind of setup, until i realized that no matter how many pages/subforms
you have, the user can only look at one subform on one tabpage at any given
point in time. since subforms add a lot of overhead to a form, it's worth
the effort to learn how to use *one* subform, set "behind" the tab control,
so it shows on every tabpage, and change that one subform's SourceObject
property as you move between tabpages. the result is that when you click on
the fees tab, the fees subform is loaded into the subform control; when you
click on the inspections tab, the inspections subform is loaded into the
subform control, etc. this action is normally transparent to the user.

regarding your "real" db design education: welcome to the crowd.

hth


<brian.flannery (AT) ci (DOT) verona.wi.us> wrote

On Mar 27, 1:54 pm, Salad <o... (AT) vinegar (DOT) com> wrote:
Quote:
brian.flann... (AT) ci (DOT) verona.wi.us wrote:
I'm trying to "hide" a report while printing. I need to open the
report in preview mode as so to count the pages (if multiple so I can
set the printer to duplex printing) and then print the number of
copies collected via input box. I've tried every combination I can
think of to suppress the report "popping up" and then going away.
Here's an example of what I'm doing.

stDocName = "rptMyReport"

intCopies = InputBox("Enter the number of copies to print", "Copies",
1, 5000, 4000)

DoCmd.OpenReport stDocName, acViewPreview, "", "My Filter"

'Check to see the number of pages. If it is greater than 1, the
printer is set to duplex printing

If Reports!rptMyReport.Pages > 1 Then

Set prtFirst = Application.Printers(0)

With Reports(stDocName).Printer

.Duplex = acPRDPVertical

End With

DoCmd.PrintOut acPrintAll, , , acHigh, intCopies, False

With Reports(stDocName).Printer

.Duplex = acPRDPSimplex

End With

DoCmd.Close acReport, stDocName, acSaveNo

Else
DoCmd.OpenReport stDocName, acViewPreview, "", "My Filter"

DoCmd.PrintOut acPrintAll, , , acHigh, intCopies, False

DoCmd.Close acReport, stDocName, acSaveNo

End If

stDocName = ""

Exit Sub

'Error Handler

Error_Handler:

MsgBox err.Description

DoCmd.CancelEvent

Any suggestions would be greatly appreciated. I don't have much
hair left. :-)

MG Fosters is beneficial when opening a report. I suppose if the report
is open, the property you can experiment with is Visible to hide it.
Me.Visible = False
Me.Visible = True

Since reports print quickly, I'm not sure why you want to Hide the
report. I think this would cause some flicker or maybe confusion as it
becomes visible and invisible. Maybe the hourglass would work just as
well.
Docmd.Hourglass True
Docmd.Hourglass False
and this would show there's an action occurring while the housglass is
visible. Just a thought.
I've tried several different combinations using "acHidden" as well as
"Me.Visible" and even have gone so far as trying "Echo". The only way
everything seems to work properly is the way I have posted. Other
combinations either don't print right (i.e. number of copies), or
don't filter at all (the Where Condition) or don't set the printer
properly.

I'll be the first to admit that the db in question probably isn't the
most efficient or even properly laid out. I'm sure the design of the
form which is open while all of this takes place is mostly to blame.
I'm not a professional developer. Most of my "real" db design
education has been through trial and error, or by reading and applying
the vast knowledge of the many wonderful posters within this
group.

That being said, what may be making this problem more significant is
the fact that we are using Shrinker Stretcher to enlarge the view.
The db was originally designed based on the screen resolution of a 15"
laptop and is now being viewed by three users on 22" monitors. The
dynamic SS utility seems to slow down the screen reaction time which
I'm sure is mostly because the main user form is pretty "busy". Like
I said, it's probably a poor design, but the main user form is a form,
with a tab control and twelve subforms. I don't know what the magic
number of subforms should be, but good or bad, it's really efficient
for the way we do business. We rely on going to one record within the
form and then switching to related information on the various
subforms- and back and forth between the tabs. It's a municipal
permit db. So we go to a permit, and then tab from contractors to
fees, inspections, pictures, etc. I've thought about switching to pop
up forms but I think it would become too cumbersome having to
continually open and close forms all the time. Anyway, back to the
question at hand...

When the user opts to print the report, the report "flashes" but then
the screen hangs while (I'm assuming) it needs to repaint itself which
takes what seems like an eternity and from a purely visual standpoint,
looks like crap. I've got to believe that there is a simple way that
I'm overlooking that would "force" the report to do it's thing behind
the form and out of sight.

Well, I've bared my soul for both ridicule and help. Thanks for
letting me ramble on. Again, any thoughts, suggestions and direction
would be appreciated. Thanks again.




Reply With Quote
  #6  
Old   
Salad
 
Posts: n/a

Default Re: Hiding a report while printing ACC 2003 - 03-28-2009 , 09:22 AM



brian.flannery (AT) ci (DOT) verona.wi.us wrote:
Quote:
On Mar 27, 1:54 pm, Salad <o... (AT) vinegar (DOT) com> wrote:

brian.flann... (AT) ci (DOT) verona.wi.us wrote:

I'm trying to "hide" a report while printing. I need to open the
report in preview mode as so to count the pages (if multiple so I can
set the printer to duplex printing) and then print the number of
copies collected via input box. I've tried every combination I can
think of to suppress the report "popping up" and then going away.
Here's an example of what I'm doing.

stDocName = "rptMyReport"

intCopies = InputBox("Enter the number of copies to print", "Copies",
1, 5000, 4000)

DoCmd.OpenReport stDocName, acViewPreview, "", "My Filter"

'Check to see the number of pages. If it is greater than 1, the
printer is set to duplex printing

If Reports!rptMyReport.Pages > 1 Then

Set prtFirst = Application.Printers(0)

With Reports(stDocName).Printer

.Duplex = acPRDPVertical

End With

DoCmd.PrintOut acPrintAll, , , acHigh, intCopies, False

With Reports(stDocName).Printer

.Duplex = acPRDPSimplex

End With

DoCmd.Close acReport, stDocName, acSaveNo

Else
DoCmd.OpenReport stDocName, acViewPreview, "", "My Filter"

DoCmd.PrintOut acPrintAll, , , acHigh, intCopies, False

DoCmd.Close acReport, stDocName, acSaveNo

End If

stDocName = ""

Exit Sub

'Error Handler

Error_Handler:

MsgBox err.Description

DoCmd.CancelEvent

Any suggestions would be greatly appreciated. I don't have much
hair left. :-)

MG Fosters is beneficial when opening a report. I suppose if the report
is open, the property you can experiment with is Visible to hide it.
Me.Visible = False
Me.Visible = True

Since reports print quickly, I'm not sure why you want to Hide the
report. I think this would cause some flicker or maybe confusion as it
becomes visible and invisible. Maybe the hourglass would work just as well.
Docmd.Hourglass True
Docmd.Hourglass False
and this would show there's an action occurring while the housglass is
visible. Just a thought.


I've tried several different combinations using "acHidden" as well as
"Me.Visible" and even have gone so far as trying "Echo". The only way
everything seems to work properly is the way I have posted. Other
combinations either don't print right (i.e. number of copies), or
don't filter at all (the Where Condition) or don't set the printer
properly.

I'll be the first to admit that the db in question probably isn't the
most efficient or even properly laid out. I'm sure the design of the
form which is open while all of this takes place is mostly to blame.
I'm not a professional developer. Most of my "real" db design
education has been through trial and error, or by reading and applying
the vast knowledge of the many wonderful posters within this
group.

That being said, what may be making this problem more significant is
the fact that we are using Shrinker Stretcher to enlarge the view.
The db was originally designed based on the screen resolution of a 15"
laptop and is now being viewed by three users on 22" monitors. The
dynamic SS utility seems to slow down the screen reaction time which
I'm sure is mostly because the main user form is pretty "busy". Like
I said, it's probably a poor design, but the main user form is a form,
with a tab control and twelve subforms. I don't know what the magic
number of subforms should be, but good or bad, it's really efficient
for the way we do business. We rely on going to one record within the
form and then switching to related information on the various
subforms- and back and forth between the tabs. It's a municipal
permit db. So we go to a permit, and then tab from contractors to
fees, inspections, pictures, etc. I've thought about switching to pop
up forms but I think it would become too cumbersome having to
continually open and close forms all the time. Anyway, back to the
question at hand...

When the user opts to print the report, the report "flashes" but then
the screen hangs while (I'm assuming) it needs to repaint itself which
takes what seems like an eternity and from a purely visual standpoint,
looks like crap. I've got to believe that there is a simple way that
I'm overlooking that would "force" the report to do it's thing behind
the form and out of sight.

Well, I've bared my soul for both ridicule and help. Thanks for
letting me ramble on. Again, any thoughts, suggestions and direction
would be appreciated. Thanks again.
What happens if you were to open the report hidden. Then get the page
count and store it to a variable. BTW, are you sure Printers(0) will
always be the same printer for every user? Maybe then set (assumes the
report will use the default printer), the setting for it first (I might
want to store the defaults first) and then close the report then loop
thru the number of copies.


Reply With Quote
  #7  
Old   
brian.flannery@ci.verona.wi.us
 
Posts: n/a

Default Re: Hiding a report while printing ACC 2003 - 03-28-2009 , 12:22 PM



On Mar 28, 10:22*am, Salad <o... (AT) vinegar (DOT) com> wrote:
Quote:
brian.flann... (AT) ci (DOT) verona.wi.us wrote:
On Mar 27, 1:54 pm, Salad <o... (AT) vinegar (DOT) com> wrote:

brian.flann... (AT) ci (DOT) verona.wi.us wrote:

I'm trying to "hide" a report while printing. *I need to open the
report in preview mode as so to count the pages (if multiple so I can
set the printer to duplex printing) and then print the number of
copies collected via input box. *I've tried every combination I can
think of to suppress the report "popping up" and then going away.
Here's an example of what I'm doing.

stDocName = "rptMyReport"

intCopies = InputBox("Enter the number of copies to print", "Copies",
1, 5000, 4000)

DoCmd.OpenReport stDocName, acViewPreview, "", "My Filter"

*'Check to see the number of pages. *If it is greater than 1, the
printer is set to duplex printing

*If Reports!rptMyReport.Pages > 1 Then

* *Set prtFirst = Application.Printers(0)

* *With Reports(stDocName).Printer

* * * *.Duplex = acPRDPVertical

* *End With

* *DoCmd.PrintOut acPrintAll, , , acHigh, intCopies, False

* *With Reports(stDocName).Printer

* * * *.Duplex = acPRDPSimplex

* *End With

* *DoCmd.Close acReport, stDocName, acSaveNo

Else
* *DoCmd.OpenReport stDocName, acViewPreview, "", "My Filter"

* *DoCmd.PrintOut acPrintAll, , , acHigh, intCopies, False

* *DoCmd.Close acReport, stDocName, acSaveNo

End If

*stDocName = ""

Exit Sub

* *'Error Handler

Error_Handler:

* *MsgBox err.Description

* *DoCmd.CancelEvent

*Any suggestions would be greatly appreciated. *I don't have much
hair left. *:-)

MG Fosters is beneficial when opening a report. *I suppose if the report
is open, the property you can experiment with is Visible to hide it.
* * * *Me.Visible = False
* * * *Me.Visible = True

Since reports print quickly, I'm not sure why you want to Hide the
report. *I think this would cause some flicker or maybe confusion as it
becomes visible and invisible. *Maybe the hourglass would work just as well.
* * * *Docmd.Hourglass True
* * * *Docmd.Hourglass False
and this would show there's an action occurring while the housglass is
visible. *Just a thought.

I've tried several different combinations using "acHidden" as well as
"Me.Visible" and even have gone so far as trying "Echo". *The only way
everything seems to work properly is the way I have posted. *Other
combinations either don't print right (i.e. number of copies), or
don't filter at all (the Where Condition) or don't set the printer
properly.

I'll be the first to admit that the db in question probably isn't the
most efficient or even properly laid out. * I'm sure the design of the
form which is open while all of this takes place is mostly to blame.
I'm not a professional developer. *Most of my "real" db design
education has been through trial and error, or by reading and applying
the vast knowledge of the many wonderful posters within this
group.

That being said, what may be *making this problem more significant is
the fact that we are using Shrinker Stretcher to enlarge the view.
The db was originally designed based on the screen resolution of a 15"
laptop and is now being viewed by three users on 22" monitors. *The
dynamic SS utility seems to slow down the screen reaction time which
I'm sure is mostly because the main user form is pretty "busy". *Like
I said, it's probably a poor design, but the main user form is a form,
with a tab control and twelve subforms. *I don't know what the magic
number of subforms should be, but good or bad, it's really efficient
for the way we do business. *We rely on going to one record within the
form and then switching to related information on the various
subforms- and back and forth between the tabs. *It's a municipal
permit db. *So we go to a permit, and then tab from contractors to
fees, inspections, pictures, etc. *I've thought about switching to pop
up forms but I think it would become too cumbersome having to
continually open and close forms all the time. *Anyway, back to the
question at hand...

When the user opts to print the report, the report "flashes" but then
the screen hangs while (I'm assuming) it needs to repaint itself which
takes what seems like an eternity and from a purely visual standpoint,
looks like crap. *I've got to believe that there is a simple way that
I'm overlooking that would "force" the report to do it's thing behind
the form and out of sight.

Well, I've bared my soul for both ridicule and help. *Thanks for
letting me ramble on. *Again, any thoughts, suggestions and direction
would be appreciated. *Thanks again.

What happens if you were to open the report hidden. *Then get the page
count and store it to a variable. *BTW, are you sure Printers(0) will
always be the same printer for every user? Maybe then set (assumes the
report will use the default printer), the setting for it first (I might
want to store the defaults first) and then close the report then loop
thru the number of copies.
Not to sound stupid...but can you be a little more specific? I think
I get where you're going, but I don't think I can get there.


Reply With Quote
  #8  
Old   
Tony Toews [MVP]
 
Posts: n/a

Default Re: Hiding a report while printing ACC 2003 - 03-28-2009 , 02:52 PM



brian.flannery (AT) ci (DOT) verona.wi.us wrote:

Quote:
'Check to see the number of pages. If it is greater than 1, the
printer is set to duplex printing
Why? If you send multiple copies of a 1 page reports to a printer they each should
print on their own sheet of paper and not print one on each side.

If this is the case I'm quite curious as to the make and model of the printer and if
the printer drivers are up to date?

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/


Reply With Quote
  #9  
Old   
Salad
 
Posts: n/a

Default Re: Hiding a report while printing ACC 2003 - 03-28-2009 , 06:54 PM



brian.flannery (AT) ci (DOT) verona.wi.us wrote:

Quote:
On Mar 28, 10:22 am, Salad <o... (AT) vinegar (DOT) com> wrote:

brian.flann... (AT) ci (DOT) verona.wi.us wrote:

On Mar 27, 1:54 pm, Salad <o... (AT) vinegar (DOT) com> wrote:

brian.flann... (AT) ci (DOT) verona.wi.us wrote:

I'm trying to "hide" a report while printing. I need to open the
report in preview mode as so to count the pages (if multiple so I can
set the printer to duplex printing) and then print the number of
copies collected via input box. I've tried every combination I can
think of to suppress the report "popping up" and then going away.
Here's an example of what I'm doing.

stDocName = "rptMyReport"

intCopies = InputBox("Enter the number of copies to print", "Copies",
1, 5000, 4000)

DoCmd.OpenReport stDocName, acViewPreview, "", "My Filter"

'Check to see the number of pages. If it is greater than 1, the
printer is set to duplex printing

If Reports!rptMyReport.Pages > 1 Then

Set prtFirst = Application.Printers(0)

With Reports(stDocName).Printer

.Duplex = acPRDPVertical

End With

DoCmd.PrintOut acPrintAll, , , acHigh, intCopies, False

With Reports(stDocName).Printer

.Duplex = acPRDPSimplex

End With

DoCmd.Close acReport, stDocName, acSaveNo

Else
DoCmd.OpenReport stDocName, acViewPreview, "", "My Filter"

DoCmd.PrintOut acPrintAll, , , acHigh, intCopies, False

DoCmd.Close acReport, stDocName, acSaveNo

End If

stDocName = ""

Exit Sub

'Error Handler

Error_Handler:

MsgBox err.Description

DoCmd.CancelEvent

Any suggestions would be greatly appreciated. I don't have much
hair left. :-)

MG Fosters is beneficial when opening a report. I suppose if the report
is open, the property you can experiment with is Visible to hide it.
Me.Visible = False
Me.Visible = True

Since reports print quickly, I'm not sure why you want to Hide the
report. I think this would cause some flicker or maybe confusion as it
becomes visible and invisible. Maybe the hourglass would work just as well.
Docmd.Hourglass True
Docmd.Hourglass False
and this would show there's an action occurring while the housglass is
visible. Just a thought.

I've tried several different combinations using "acHidden" as well as
"Me.Visible" and even have gone so far as trying "Echo". The only way
everything seems to work properly is the way I have posted. Other
combinations either don't print right (i.e. number of copies), or
don't filter at all (the Where Condition) or don't set the printer
properly.

I'll be the first to admit that the db in question probably isn't the
most efficient or even properly laid out. I'm sure the design of the
form which is open while all of this takes place is mostly to blame.
I'm not a professional developer. Most of my "real" db design
education has been through trial and error, or by reading and applying
the vast knowledge of the many wonderful posters within this
group.

That being said, what may be making this problem more significant is
the fact that we are using Shrinker Stretcher to enlarge the view.
The db was originally designed based on the screen resolution of a 15"
laptop and is now being viewed by three users on 22" monitors. The
dynamic SS utility seems to slow down the screen reaction time which
I'm sure is mostly because the main user form is pretty "busy". Like
I said, it's probably a poor design, but the main user form is a form,
with a tab control and twelve subforms. I don't know what the magic
number of subforms should be, but good or bad, it's really efficient
for the way we do business. We rely on going to one record within the
form and then switching to related information on the various
subforms- and back and forth between the tabs. It's a municipal
permit db. So we go to a permit, and then tab from contractors to
fees, inspections, pictures, etc. I've thought about switching to pop
up forms but I think it would become too cumbersome having to
continually open and close forms all the time. Anyway, back to the
question at hand...

When the user opts to print the report, the report "flashes" but then
the screen hangs while (I'm assuming) it needs to repaint itself which
takes what seems like an eternity and from a purely visual standpoint,
looks like crap. I've got to believe that there is a simple way that
I'm overlooking that would "force" the report to do it's thing behind
the form and out of sight.

Well, I've bared my soul for both ridicule and help. Thanks for
letting me ramble on. Again, any thoughts, suggestions and direction
would be appreciated. Thanks again.

What happens if you were to open the report hidden. Then get the page
count and store it to a variable. BTW, are you sure Printers(0) will
always be the same printer for every user? Maybe then set (assumes the
report will use the default printer), the setting for it first (I might
want to store the defaults first) and then close the report then loop
thru the number of copies.


Not to sound stupid...but can you be a little more specific? I think
I get where you're going, but I don't think I can get there.
Something like...I'm not testing here.

intCopies = InputBox("Enter the number of copies to print", "Copies",
1, 5000, 4000)

Dim stDocName As String
Dim intPages As Integer

stDocName = "rptMyReport"
'Note: I have no idea what MyFilter is. In your code, you have in the
'Where condition argument position...normally it'd look like
'"CustomerID = 1", not MyFilter unless MyFilter was a variable
'and not a string.
DoCmd.OpenReport stDocName, acViewPreview, "My Filter", , acHidden

intPages As Integer
intPage = Reports(stDocName).Report.Pages

DoCmd.Close acReport, stDocName

If intPages > 1 then
...code
else
...code
endif


You could make visible by
Reports(stDocName).Report.Visible = True
and hide with
Reports(stDocName).Report.Visible = False


For loop
For intFor = 1 to intPages
Report form stDocName...
Next

Actually, I like Tina's response. Why not have it set to duplicate and
let the program print it out?



Reply With Quote
  #10  
Old   
brian.flannery@ci.verona.wi.us
 
Posts: n/a

Default Re: Hiding a report while printing ACC 2003 - 03-29-2009 , 12:11 AM



On Mar 28, 3:52*pm, "Tony Toews [MVP]" <tto... (AT) telusplanet (DOT) net> wrote:
Quote:
brian.flann... (AT) ci (DOT) verona.wi.us wrote:
*'Check to see the number of pages. *If it is greater than 1, the
printer is set to duplex printing

Why? * If you send multiple copies of a 1 page reports to a printer they each should
print on their own sheet of paper and not print one on each side.

If this is the case I'm quite curious as to the make and model of the printer and if
the printer drivers are up to date? *

Tony
--
Tony Toews, Microsoft Access MVP
* *Please respond only in the newsgroups so that others can
read the entire thread of messages.
* *Microsoft Access Links, Hints, Tips & Accounting Systems athttp://www.granite.ab.ca/accsmstr.htm
* *Tony's Microsoft Access Blog -http://msmvps.com/blogs/access/
Tony-
The report is a building permit application. The applicant
information prints on the front and the "legal stuff" and signature
areas print on the back. In some instances, the information is short
enough to fit on one page, but the majority is on two. The remaining
reports within the db print one sheet/page (simplex).


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.