Home All Groups Group Topic Archive Search About

Determine when report printed to specific printer

Author
13 Oct 2005 12:57 PM
Matt Williamson
I need to send a notification email when a report is printed to a specific
printer. I'm not sure how to determine when something is printed to a
specific printer. I'm doing this in vba in access 97 and I'm thinking API
will be needed, but I'm not sure what and the search terms for the archive
are just too broad until I figure out better search criteria.

-TIA

Matt

Author
13 Oct 2005 7:00 PM
Karl E. Peterson
Matt Williamson wrote:
> I need to send a notification email when a report is printed to a
> specific printer. I'm not sure how to determine when something is
> printed to a specific printer. I'm doing this in vba in access 97 and
> I'm thinking API will be needed, but I'm not sure what and the search
> terms for the archive are just too broad until I figure out better
> search criteria.

Monitoring the print queue of a printer isn't too difficult, but it can be rather
involved.  To see a VB implementation, have a look at
http://vb.mvps.org/samples/PrnInfo.  Another approach might be using
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/prntspol_9sxa.asp,
though that gets difficult if your application needs to be doing other stuff too.
--
Working Without a .NET?
http://classicvb.org/petition
Author
13 Oct 2005 7:21 PM
Matt Williamson
It's funny that you answered this. I've downloaded all of the examples on
your site and stuck them in an examples directory that I look through any
time I need help with something. The majority of the time, I find something
that I can modify to make work.
I was actually just looking at the example you mentioned before I saw this
<g>.

The only issue I'm running into is that you enumerate the printers through
the VB printers collection in your code, but Access 97 VBA doesn't have a
printers collection that I know of. I'm pretty sure I've seen a class module
that replaces the Printer object, but I don't remember where. Do you
remember seeing it out in the ether somewhere?

TIA

Matt

Show quoteHide quote
"Karl E. Peterson" <k***@mvps.org> wrote in message
news:OnCVniC0FHA.3256@TK2MSFTNGP09.phx.gbl...
> Matt Williamson wrote:
>> I need to send a notification email when a report is printed to a
>> specific printer. I'm not sure how to determine when something is
>> printed to a specific printer. I'm doing this in vba in access 97 and
>> I'm thinking API will be needed, but I'm not sure what and the search
>> terms for the archive are just too broad until I figure out better
>> search criteria.
>
> Monitoring the print queue of a printer isn't too difficult, but it can be
> rather
> involved.  To see a VB implementation, have a look at
> http://vb.mvps.org/samples/PrnInfo.  Another approach might be using
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/prntspol_9sxa.asp,
> though that gets difficult if your application needs to be doing other
> stuff too.
> --
> Working Without a .NET?
> http://classicvb.org/petition
>
>
Author
13 Oct 2005 8:10 PM
Karl E. Peterson
Hi Matt --

>> To see a VB implementation, have a look at
>> http://vb.mvps.org/samples/PrnInfo.
>
> It's funny that you answered this. I've downloaded all of the
> examples on your site and stuck them in an examples directory that I
> look through any time I need help with something. The majority of the
> time, I find something that I can modify to make work.
> I was actually just looking at the example you mentioned before I saw
> this <g>.

Kewl.  :-)

> The only issue I'm running into is that you enumerate the printers
> through the VB printers collection in your code, but Access 97 VBA
> doesn't have a printers collection that I know of. I'm pretty sure
> I've seen a class module that replaces the Printer object, but I
> don't remember where. Do you remember seeing it out in the ether
> somewhere?

Ummm, same example? <vbg>

There was a bug in the VB5 printers collection (scroll down to "Bug in VB5 Printers
Collection", same page <G>), where if there were more than "so many" printers
installed, not all would be included.  That class (CPrinters) ought to work in VBA, I
believe.

Thanks...   Karl
--
Working Without a .NET?
http://classicvb.org/petition