Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 30th, 2006, 04:55 PM
Authorized User
 
Join Date: Feb 2004
Location: , , Canada.
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:)

Reply With Quote
  #2 (permalink)  
Old December 1st, 2006, 10:35 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
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
Reply With Quote
  #3 (permalink)  
Old December 6th, 2006, 08:16 PM
Authorized User
 
Join Date: Feb 2004
Location: , , Canada.
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


Reply With Quote
  #4 (permalink)  
Old December 12th, 2006, 01:12 PM
Authorized User
 
Join Date: Feb 2004
Location: , , Canada.
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!

Reply With Quote
  #5 (permalink)  
Old December 13th, 2006, 10:06 PM
Registered User
 
Join Date: Nov 2006
Location: , , .
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
Reply With Quote
  #6 (permalink)  
Old December 14th, 2006, 01:11 PM
Authorized User
 
Join Date: Feb 2004
Location: , , Canada.
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!
:)

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 09:29 AM.


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