Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 30th, 2006, 04:55 PM
Authorized User
 
Join Date: Feb 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to chacquard
Default Control button to print 20 reports - doesn't work

Hello,

I have a control button. If we click on the button, it should print about 20 different reports, but it doesn't. If I use the debug, and step through the vb code, it works fine, otherwise, it doesn't.

this is the only code I have (20 times, but docname changes):

stDocName = "DailySales"
DoCmd.OpenReport stDocName, acNormal

and at the end, I have a message box notifying the user that the reports have all been printed - that message always shows up.

It feels like Access is way too fast and doesn't send the info to the printer. Do you know of a way around this ??

Thanks
Chantal:)

 
Old December 1st, 2006, 10:35 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

You could add an On Open event to each report to DoCmd.PrintOut...

The DoCmd.OpenReport just opens the report. How are you sending it to the printer?

mmcdonal
 
Old December 6th, 2006, 08:16 PM
Authorized User
 
Join Date: Feb 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to chacquard
Default


I usually send the report to the printer with
"DoCmd.OpenReport stDocName, acNormal"

I use this code to print reports on a click of a control button (1 report per button), and it works fine. It just doesn't work well with 20 reports on one control button.

If I put the DoCmd.PrintOut code in the "On Open" event of the reports, if I want to "preview" the report, it will print it.

Do you know of another code to print reports from a control button ?

Thanks

Chantal


 
Old December 12th, 2006, 01:12 PM
Authorized User
 
Join Date: Feb 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to chacquard
Default

 I sure would appreciate having your help on this one... it is a real problem for me here !:(

thanks!

 
Old December 13th, 2006, 10:06 PM
Registered User
 
Join Date: Nov 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to GolferGuy
Default

You said "It just doesn't work well with 20 reports on one control button." But you don't say how it doesn't work well. I'm going to assume that the reports sort of get all tangled up with each other. So, if I may suggest, you could put a Wait statement between each report that would wait for x seconds. Of course you will need to write the Wait function. It could look something like this:
Code:
Sub Wait(mWaitSeconds)
dim mNow as Date
  mNow = DateAdd("s", mWaitSeconds, Now())
  While mNow > Now()
    DoEvents
  WEnd
End Sub
Hope that helps,
Vic

Vic
 
Old December 14th, 2006, 01:11 PM
Authorized User
 
Join Date: Feb 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to chacquard
Default

When I wrote "it doesn't work" I meant that the reports don't print at all...

I tried the wait event and it works fine now.

Thank you!
:)






Similar Threads
Thread Thread Starter Forum Replies Last Post
Print Button itHighway Classic ASP Basics 2 February 27th, 2005 06:48 PM
'print' button crmpicco Classic ASP Basics 0 February 8th, 2005 10:25 AM
cannot print reports Tasha Access VBA 0 August 25th, 2004 03:40 AM
print button alitoday Classic ASP Basics 1 June 5th, 2004 05:01 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.