If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Find out if report goes to a specific printer
I have defined a number of reports that need to be printed on specific
printers (because they have particular stationery loaded). What I need to do now is check that the user has that printer installed on their machine. I have noticed that when I hover my mouse over a report name (Access 2002), I get a tooltip telling me where this report will print. Is there any way I can programatically retrieve this information? (Having got this, I can loop through the Printers collection to see if it's installed or not). |
#2
|
|||
|
|||
Find out if report goes to a specific printer
Jon:
I believe the PrtDevMode property of the report contains this information. Please see the following reference for more information. http://msdn.microsoft.com/library/de...PrtDevMode.asp -- David Lloyd MCSD .NET http://LemingtonConsulting.com This response is supplied "as is" without any representations or warranties. "Jon Ley" wrote in message ... I have defined a number of reports that need to be printed on specific printers (because they have particular stationery loaded). What I need to do now is check that the user has that printer installed on their machine. I have noticed that when I hover my mouse over a report name (Access 2002), I get a tooltip telling me where this report will print. Is there any way I can programatically retrieve this information? (Having got this, I can loop through the Printers collection to see if it's installed or not). |
#3
|
|||
|
|||
Find out if report goes to a specific printer
David,
Looks like a good place to start, however having tried it I have a couple of issues. Firstly if I examine the DeviceName property I get gibberish back (lots of question marks and squares). I am not 100% convinced that the type_DEVMODE definition is correct - the article says it is a 94 byte structure, but I count 95! Anyway, even if I can get something useful back from this, the other problem I have is that I won't be able to open the report in design mode from an MDE. Anybody have any other ideas? Jon. "David Lloyd" wrote: Jon: I believe the PrtDevMode property of the report contains this information. Please see the following reference for more information. http://msdn.microsoft.com/library/de...PrtDevMode.asp -- David Lloyd MCSD .NET http://LemingtonConsulting.com This response is supplied "as is" without any representations or warranties. "Jon Ley" wrote in message ... I have defined a number of reports that need to be printed on specific printers (because they have particular stationery loaded). What I need to do now is check that the user has that printer installed on their machine. I have noticed that when I hover my mouse over a report name (Access 2002), I get a tooltip telling me where this report will print. Is there any way I can programatically retrieve this information? (Having got this, I can loop through the Printers collection to see if it's installed or not). |
#4
|
|||
|
|||
Find out if report goes to a specific printer
There is nothing wrong with the PrtDevMode property which exposes a Devmode
structure. Yes, it is 94 bytes. How could it possibly be an odd number(95) when every member of the structure is either 2, 4, 16 or 32 bytes in length? It is not a string that's why you cannot examine it directly. Have you tried using the MS KB code that is referenced in this thread? If so what problems are you having implementing this code. I'm sure someone here can help you. -- HTH Stephen Lebans http://www.lebans.com Access Code, Tips and Tricks Please respond only to the newsgroups so everyone can benefit. "Jon Ley" wrote in message ... David, Looks like a good place to start, however having tried it I have a couple of issues. Firstly if I examine the DeviceName property I get gibberish back (lots of question marks and squares). I am not 100% convinced that the type_DEVMODE definition is correct - the article says it is a 94 byte structure, but I count 95! Anyway, even if I can get something useful back from this, the other problem I have is that I won't be able to open the report in design mode from an MDE. Anybody have any other ideas? Jon. "David Lloyd" wrote: Jon: I believe the PrtDevMode property of the report contains this information. Please see the following reference for more information. http://msdn.microsoft.com/library/de...PrtDevMode.asp -- David Lloyd MCSD .NET http://LemingtonConsulting.com This response is supplied "as is" without any representations or warranties. "Jon Ley" wrote in message ... I have defined a number of reports that need to be printed on specific printers (because they have particular stationery loaded). What I need to do now is check that the user has that printer installed on their machine. I have noticed that when I hover my mouse over a report name (Access 2002), I get a tooltip telling me where this report will print. Is there any way I can programatically retrieve this information? (Having got this, I can loop through the Printers collection to see if it's installed or not). |
#5
|
|||
|
|||
Find out if report goes to a specific printer
Stephen,
Thanks for chipping in on this one. Where to start?! [Aside - OK, so I don't understand the PrtDevMode structure. When I looked at it, I had in the back of my mind that Integer = 2 bytes and Long = 4 bytes, and I guessed that String * 32 would mean 32 bytes, so adding up all the elements gave me 112 (17 Integers, 7 Longs and 2 32-byte strings). So I thought that maybe I'd remembered the Integer and Long incorrectly and maybe they should be 1 and 2 bytes respectively, which is where I got my count of 95 from. Anyway, I see now that my memory wasn't failing me after all with the Integers and Longs, so that still leaves me very confused as to where the 94 comes from. Anyway, this is all kind of irrelevant as ...] I have tried running both the sample procs in the referenced article, and neither seems to have any effect that I can detect. For example, running SwitchOrient opens my report in design mode and then allegedly switches the orientation of the report. However having run this code, if I go to preview the report, it is still in its original orientation. Similarly, running CheckCustomPage and setting the custom page size to something very obviously different (15 long by 5 wide) is not reflected in the print preview. Anyway, this is also not necessarily a problem as I don't really want to change anything, I just want to examine the current settings, which leads me to ... "It's not a string, that's why you cannot examine it directly." So how _do_ I examine it? The whole point of this question is that I want to find the name of the device that a given report will print to. Anyway, thinking further about my original request and about how the PrtDevMode suggestion may help with this ... I notice, re-reading the PrtDevMode description, that this returns a generic "HP LaserJet IIISi" as the DeviceName, rather than the specific installed instance of this device that I see in the tooltip when I hover over the report (the same name that is listed in my Printers folder, or if I loop through the Access Printers collection). This is important as I have multiple printers installed that would give the same PrtDevMode DeviceName, but one of them has specific stationery loaded. If a report has been set up to go to this specific printer, I need to check that the user has this printer installed on their machine. You also did not address my issue that the sample code depends on first opening the report in design mode, which I will not be able to do as I would be running it from an MDE. Sorry, very long-winded reply to raise loads of further questions, none of which I really need answering necessarily, if, as I suspect, the PrtDevMode approach is not going to solve my original question (although feel free to wax lyrical on how stupid I am for not understanding the intricacies of this structure - I will quite happily admit that I tend to glaze over a bit when the Win32 SDK is mentioned!). My original question remains - how do I programatically retrieve the information that is displayed in the tooltip when I hover over a report? "Stephen Lebans" wrote: There is nothing wrong with the PrtDevMode property which exposes a Devmode structure. Yes, it is 94 bytes. How could it possibly be an odd number(95) when every member of the structure is either 2, 4, 16 or 32 bytes in length? It is not a string that's why you cannot examine it directly. Have you tried using the MS KB code that is referenced in this thread? If so what problems are you having implementing this code. I'm sure someone here can help you. -- HTH Stephen Lebans http://www.lebans.com Access Code, Tips and Tricks Please respond only to the newsgroups so everyone can benefit. "Jon Ley" wrote in message ... David, Looks like a good place to start, however having tried it I have a couple of issues. Firstly if I examine the DeviceName property I get gibberish back (lots of question marks and squares). I am not 100% convinced that the type_DEVMODE definition is correct - the article says it is a 94 byte structure, but I count 95! Anyway, even if I can get something useful back from this, the other problem I have is that I won't be able to open the report in design mode from an MDE. Anybody have any other ideas? Jon. "David Lloyd" wrote: Jon: I believe the PrtDevMode property of the report contains this information. Please see the following reference for more information. http://msdn.microsoft.com/library/de...PrtDevMode.asp -- David Lloyd MCSD .NET http://LemingtonConsulting.com This response is supplied "as is" without any representations or warranties. "Jon Ley" wrote in message ... I have defined a number of reports that need to be printed on specific printers (because they have particular stationery loaded). What I need to do now is check that the user has that printer installed on their machine. I have noticed that when I hover my mouse over a report name (Access 2002), I get a tooltip telling me where this report will print. Is there any way I can programatically retrieve this information? (Having got this, I can loop through the Printers collection to see if it's installed or not). |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Printer Control and Print/Preview Problems | Peter Hallett | Setting Up & Running Reports | 3 | November 5th, 2005 03:19 AM |
Reporting subreport total on main report | BobV | Setting Up & Running Reports | 22 | November 1st, 2005 03:19 AM |
Has anyone seen this behaviour? What might it be? | tw | General Discussion | 4 | June 30th, 2005 03:23 PM |
dynamic crosstab A2002 | Brigitte P | Running & Setting Up Queries | 13 | January 2nd, 2005 04:25 PM |
decipher log of scanpst.exe | km | General Discussion | 0 | July 18th, 2004 09:00 AM |