Rabu, 15 Agustus 2012

RE: [MS_AccessPros] Re: Assigning printing setting through API

Miroslav:
I have used this code in an MDE, in versions 2002 and 2003, so I know it works there, but I have not yet tried the ACCDE file type with this. But please note that it is the Report that gets the custom paper size, not the printer.


The custom size needs to be created and saved on each computer, then referenced in code such as:




Private Sub cmdInvoiceRpt_click()


Dim strName as string


strName="rptInvoice"


DoCmd.OpenReport
strName, acViewPreview, , "invoiceid=" & me.invoiceid


Set rpt =
Reports(strName)


rpt.Printer =
Application.Printers(AppPropLookup("InvoicePrinter"))


rpt.Paper =
AppPropLookup("InvoicePaper")



End Sub



I am not completely clear on what your issue is but I am (somewhat) convinced the resolution is in my prior work on this issue somewhere.


hth

Steve



To: MS_Access_Professionals@yahoogroups.com
From: mirkosluv@gmail.com
Date: Wed, 15 Aug 2012 09:22:45 +0000
Subject: [MS_AccessPros] Re: Assigning printing setting through API




























Steve, thanks, that would be great, but we are in this whole mess exactly because this doesn't work.

Driver of course properly returns paper size in DEVMODE structure, but you have nothing with Printer object to assign it to (no PaperWidth and PaperHeight properties).



Worse thing is that we can freely modify system printer through DocumentProperties API, set everything needed, assign modified printer to our report (which in turn modifies it's prtDevMode structure), but we can't do it directly. Process of modifying system printer, assigning it to report and then returning printer to previous state is of course VERY slow, but somebody in Access team decided prtDevMode is read-only from inside and only printer driver is allowed to modify it. It is not read only even through exposed Printer object, as we know it, so what's the point?



MS should either wrap full functionality into Printer object, either allow modification of prtDevMode in preview mode. As it is, the only way to do it is as described before.



--- In MS_Access_Professionals@yahoogroups.com, Steve Conklin <StephenMConklin@...> wrote:

>

> Miroslav:

>

> Maybe Win7 uses these higher numbers, my client is on XP still.

>

> In any case, try something like this:

>

> Set rpt = Reports(strName)

>

> rpt.Printer = Application.Printers(glngInvoicePrinter)

>

> rpt.Paper = YOUR PAPER SIZE NUMBER

>

> hth

>

> Steve

>

>

>

>

>

>

>

> To: MS_Access_Professionals@yahoogroups.com

> From: mirkosluv@...

> Date: Tue, 14 Aug 2012 15:18:09 +0000

> Subject: [MS_AccessPros] Re: Assigning printing setting through API

>

>

>

>

>

> Dear Steve, thanks, I just double-checked, various printers return paper sizes as 256, 257 etc and while I have no problems reading correct dimensions for such custom sizes from DEVMODE, I do not have a way to apply them back through the Printer object.

>

> Miroslav

> --- In MS_Access_Professionals@yahoogroups.com, Steve Conklin <StephenMConklin@> wrote:

> >

> > Custom paper sizes are genenrally from 129 through 255 ... Back in Win98, it was a constant 255, because then you could only have one custom size per printer. With XP, you could have more than one ... I have a client who consistently gets the custom paper sizes numbered as 143, 155 and 169.

> > As this is a small shop, I can create the custom size, assign it as default, and have the Printer object tell me the custom paper's number. Then, I store that value in a local table, when the need the report that uses custom, I set the printer's paper to that number, print, then set it back to whatever it was before.

> > In a larger environment, you can query the registry for the custom paper size values.

> > I am out in the field currently; I can give more details later. Or if Advisor.com is still up, I wrote about this Access/VB/SQL Advisor back in 2006, maybe it's still up.

> >

> > hth,

> > Steve Conklin

> >

> >

> >

> >

> >

> >

> > To: MS_Access_Professionals@yahoogroups.com

> > From: mirkosluv@

> > Date: Mon, 13 Aug 2012 15:34:14 +0000

> > Subject: [MS_AccessPros] Re: Assigning printing setting through API

> >

> >

> >

> >

> >

> > Yes, you can't work with custom paper sizes and many of our clients have this requirement. Printer object does not expose PaperLength and PaperWidth members of the DEVMODE structure, so we are forced to go different path, unfortunately.

> >

> > I was just hoping someone maybe knows if "replacing" report's prtDevMode property through API directly would be possible, in order to avoid "going around" process, as described in first post.

> >

> > --- In MS_Access_Professionals@yahoogroups.com, "acravenrohm" <yahoo@> wrote:

> > >

> > > OK, I'm surprised you can't set Papersizes > 256 but I see thre are one or two esoteric Settings which you seemingly can't set through the Printer Object.

> >

> >

> >

> >

> >

> >

> > [Non-text portions of this message have been removed]

> >

>

>

>

>

>

>

> [Non-text portions of this message have been removed]

>



















[Non-text portions of this message have been removed]



------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/MS_Access_Professionals/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/MS_Access_Professionals/join
(Yahoo! ID required)

<*> To change settings via email:
MS_Access_Professionals-digest@yahoogroups.com
MS_Access_Professionals-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
MS_Access_Professionals-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/

Tidak ada komentar:

Posting Komentar