Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / SQL Server / ADP / February 2007

Tip: Looking for answers? Try searching our database.

VBA code does not break when printing

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Vadim Rapp - 15 Feb 2007 15:28 GMT
Hello,

I create a report and put the following VBA code:

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
   MsgBox "hello"
End Sub

In VBA, I put debugging break on Msgbpx line. Then I open the report for
preview, and the code breaks as it should. But then when I print from the
preview, the code runs and I see another "hello", but it does not break.

If I print the report without preview, it also does not break, though it
shows the message, so the code does run.

Why it does not break?

thanks
Alex Dybenko - 15 Feb 2007 19:14 GMT
Hi,
same here, but no idea why this happens
perhaps report print has a special mode, not breakable

Signature

Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com

> Hello,
>
[quoted text clipped - 14 lines]
>
> thanks
Vadim Rapp - 15 Feb 2007 19:56 GMT
AD> same here, but no idea why this happens
AD> perhaps report print has a special mode, not breakable

I see what's even more interesting is that errors are quietly ignored. Try
this:

==================
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
   On Error GoTo Er
   MsgBox "starting"
   CurrentProject.Connection.Execute ("bogus")    ' should result in error
   MsgBox "OK"
   Exit Sub
Er:
   MsgBox "error"
End Sub
==================

It shows "starting", but then neither "OK", nor "error"...
aaron.kempf@gmail.com - 20 Feb 2007 00:37 GMT
yeah I've noticed this before

I would just make sure you don't raise an error in this section
because it will be sunk

I mean.. make it so that no matter what it does it won't error

we had to use this detail_print event for some 'checkprinting'
application many many years ago

it's really not that big of a deal; just a quirk.. right?

>  AD> same here, but no idea why this happens
>  AD> perhaps report print has a special mode, not breakable
[quoted text clipped - 15 lines]
>
> It shows "starting", but then neither "OK", nor "error"...
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.