![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I'm trying to set a report (cheques) to print on a printer which is not the default printer using the following code. My intention is to include in an mde for distribution. I can get the print run to work OK by manually selecting the Cheque printer and paper size, but it seems to ignore the following code (even in my local mdb). Set Application.Printer = Application.Printers("Cheque Printer") Application.Printer.PaperSize = acPRPSUser Application.Printer.ItemSizeHeight = 9.35 ' also tried using twips but made no difference - 5301.45 Application.Printer.ItemSizeWidth = 26.9 '15252.3 Application.Printer.PaperBin = acPRBNTractor Application.Printer.BottomMargin = 0 Application.Printer.TopMargin = 0 Application.Printer.LeftMargin = 0 Application.Printer.RightMargin = 0 Application.Printer.Orientation = acPRORPortrait I've tried running the code before opening the report and in the report on_open event. Running Access 2002 on Windows XP. I can find no help for using the acPRPSUser constant, but feel that that might be the problem. Any ideas? |
#3
| |||
| |||
|
|
Bob Darlington wrote: I'm trying to set a report (cheques) to print on a printer which is not the default printer using the following code. My intention is to include in an mde for distribution. I can get the print run to work OK by manually selecting the Cheque printer and paper size, but it seems to ignore the following code (even in my local mdb). Set Application.Printer = Application.Printers("Cheque Printer") Application.Printer.PaperSize = acPRPSUser Application.Printer.ItemSizeHeight = 9.35 ' also tried using twips but made no difference - 5301.45 Application.Printer.ItemSizeWidth = 26.9 '15252.3 Application.Printer.PaperBin = acPRBNTractor Application.Printer.BottomMargin = 0 Application.Printer.TopMargin = 0 Application.Printer.LeftMargin = 0 Application.Printer.RightMargin = 0 Application.Printer.Orientation = acPRORPortrait I've tried running the code before opening the report and in the report on_open event. Running Access 2002 on Windows XP. I can find no help for using the acPRPSUser constant, but feel that that might be the problem. Any ideas? http://bytes.com/topic/access/answer...inter-settings http://support.microsoft.com/default...b;en-us;210283 http://bytes.com/topic/access/answer...ed-paper-sizes Then again maybe the printer only accepts specific sized paper. |
#4
| |||
| |||
|
|
"Salad" <salad (AT) oilandvinegar (DOT) com> wrote in message news:Q8adnePRUK31VzLRnZ2dnUVZ_h-dnZ2d (AT) earthlink (DOT) com... Bob Darlington wrote: I'm trying to set a report (cheques) to print on a printer which is not the default printer using the following code. My intention is to include in an mde for distribution. I can get the print run to work OK by manually selecting the Cheque printer and paper size, but it seems to ignore the following code (even in my local mdb). Set Application.Printer = Application.Printers("Cheque Printer") Application.Printer.PaperSize = acPRPSUser Application.Printer.ItemSizeHeight = 9.35 ' also tried using twips but made no difference - 5301.45 Application.Printer.ItemSizeWidth = 26.9 '15252.3 Application.Printer.PaperBin = acPRBNTractor Application.Printer.BottomMargin = 0 Application.Printer.TopMargin = 0 Application.Printer.LeftMargin = 0 Application.Printer.RightMargin = 0 Application.Printer.Orientation = acPRORPortrait I've tried running the code before opening the report and in the report on_open event. Running Access 2002 on Windows XP. I can find no help for using the acPRPSUser constant, but feel that that might be the problem. Any ideas? http://bytes.com/topic/access/answer...inter-settings http://support.microsoft.com/default...b;en-us;210283 http://bytes.com/topic/access/answer...ed-paper-sizes Then again maybe the printer only accepts specific sized paper. Salad, Thanks for the reply, but none of the references you included cover user defined paper sizes. As mentioned in my original post, I can set the paper size manually, but not through the code I posted. |
#5
| |||
| |||
|
|
Bob Darlington wrote: "Salad" <salad (AT) oilandvinegar (DOT) com> wrote in message news:Q8adnePRUK31VzLRnZ2dnUVZ_h-dnZ2d (AT) earthlink (DOT) com... Bob Darlington wrote: I'm trying to set a report (cheques) to print on a printer which is not the default printer using the following code. My intention is to include in an mde for distribution. I can get the print run to work OK by manually selecting the Cheque printer and paper size, but it seems to ignore the following code (even in my local mdb). Set Application.Printer = Application.Printers("Cheque Printer") Application.Printer.PaperSize = acPRPSUser Application.Printer.ItemSizeHeight = 9.35 ' also tried using twips but made no difference - 5301.45 Application.Printer.ItemSizeWidth = 26.9 '15252.3 Application.Printer.PaperBin = acPRBNTractor Application.Printer.BottomMargin = 0 Application.Printer.TopMargin = 0 Application.Printer.LeftMargin = 0 Application.Printer.RightMargin = 0 Application.Printer.Orientation = acPRORPortrait I've tried running the code before opening the report and in the report on_open event. Running Access 2002 on Windows XP. I can find no help for using the acPRPSUser constant, but feel that that might be the problem. Any ideas? http://bytes.com/topic/access/answer...inter-settings http://support.microsoft.com/default...b;en-us;210283 http://bytes.com/topic/access/answer...ed-paper-sizes Then again maybe the printer only accepts specific sized paper. Salad, Thanks for the reply, but none of the references you included cover user defined paper sizes. As mentioned in my original post, I can set the paper size manually, but not through the code I posted. Here's a link http://dbaspot.com/forums/ms-access/...el-size-2.html The code is similar to yours. I didn't see any decimal parts for a twips value tho you use one in your code. Maybe that is the problem. |
#6
| |||
| |||
|
|
"Salad" <salad (AT) oilandvinegar (DOT) com> wrote in message news:f_qdnVGY2JNfoizRnZ2dnUVZ_u2dnZ2d (AT) earthlink (DOT) com... Bob Darlington wrote: "Salad" <salad (AT) oilandvinegar (DOT) com> wrote in message news:Q8adnePRUK31VzLRnZ2dnUVZ_h-dnZ2d (AT) earthlink (DOT) com... Bob Darlington wrote: I'm trying to set a report (cheques) to print on a printer which is not the default printer using the following code. My intention is to include in an mde for distribution. I can get the print run to work OK by manually selecting the Cheque printer and paper size, but it seems to ignore the following code (even in my local mdb). Set Application.Printer = Application.Printers("Cheque Printer") Application.Printer.PaperSize = acPRPSUser Application.Printer.ItemSizeHeight = 9.35 ' also tried using twips but made no difference - 5301.45 Application.Printer.ItemSizeWidth = 26.9 '15252.3 Application.Printer.PaperBin = acPRBNTractor Application.Printer.BottomMargin = 0 Application.Printer.TopMargin = 0 Application.Printer.LeftMargin = 0 Application.Printer.RightMargin = 0 Application.Printer.Orientation = acPRORPortrait I've tried running the code before opening the report and in the report on_open event. Running Access 2002 on Windows XP. I can find no help for using the acPRPSUser constant, but feel that that might be the problem. Any ideas? http://bytes.com/topic/access/answer...inter-settings http://support.microsoft.com/default...b;en-us;210283 http://bytes.com/topic/access/answer...ed-paper-sizes Then again maybe the printer only accepts specific sized paper. Salad, Thanks for the reply, but none of the references you included cover user defined paper sizes. As mentioned in my original post, I can set the paper size manually, but not through the code I posted. Here's a link http://dbaspot.com/forums/ms-access/...el-size-2.html The code is similar to yours. I didn't see any decimal parts for a twips value tho you use one in your code. Maybe that is the problem. Thanks Salad. That was the code I used to build my attempt. I tried removing the decimal points as you suggested without any luck. |
#7
| |||
| |||
|
|
Bob Darlington wrote: "Salad" <salad (AT) oilandvinegar (DOT) com> wrote in message news:f_qdnVGY2JNfoizRnZ2dnUVZ_u2dnZ2d (AT) earthlink (DOT) com... Bob Darlington wrote: "Salad" <salad (AT) oilandvinegar (DOT) com> wrote in message news:Q8adnePRUK31VzLRnZ2dnUVZ_h-dnZ2d (AT) earthlink (DOT) com... Bob Darlington wrote: I'm trying to set a report (cheques) to print on a printer which is not the default printer using the following code. My intention is to include in an mde for distribution. I can get the print run to work OK by manually selecting the Cheque printer and paper size, but it seems to ignore the following code (even in my local mdb). Set Application.Printer = Application.Printers("Cheque Printer") Application.Printer.PaperSize = acPRPSUser Application.Printer.ItemSizeHeight = 9.35 ' also tried using twips but made no difference - 5301.45 Application.Printer.ItemSizeWidth = 26.9 '15252.3 Application.Printer.PaperBin = acPRBNTractor Application.Printer.BottomMargin = 0 Application.Printer.TopMargin = 0 Application.Printer.LeftMargin = 0 Application.Printer.RightMargin = 0 Application.Printer.Orientation = acPRORPortrait I've tried running the code before opening the report and in the report on_open event. Running Access 2002 on Windows XP. I can find no help for using the acPRPSUser constant, but feel that that might be the problem. Any ideas? http://bytes.com/topic/access/answer...inter-settings http://support.microsoft.com/default...b;en-us;210283 http://bytes.com/topic/access/answer...ed-paper-sizes Then again maybe the printer only accepts specific sized paper. Salad, Thanks for the reply, but none of the references you included cover user defined paper sizes. As mentioned in my original post, I can set the paper size manually, but not through the code I posted. Here's a link http://dbaspot.com/forums/ms-access/...el-size-2.html The code is similar to yours. I didn't see any decimal parts for a twips value tho you use one in your code. Maybe that is the problem. Thanks Salad. That was the code I used to build my attempt. I tried removing the decimal points as you suggested without any luck. I doubt tractor feed programs have top or bottom margins but maybe right and left margins need a value > 0. Set it manually (it prints correctly, right?). What happens if you did something like Set Application.Printer = Application.Printers("Cheque Printer") msgbox Application.Printer.ItemSizeWidth & _ Application.Printer.PaperBin & vbnewline & _ Application.Printer.BottomMargin & vbnewline & _ Application.Printer.TopMargin & vbnewline &_ Application.Printer.LeftMargin & vbnewline &_ Application.Printer.RightMargin & vbnewline &_ Application.Printer.Orientation & vbnewline &_ Application.Printer.PaperSize and get the current settings? Step thru the code as well if needed. |
#8
| |||
| |||
|
#9
| |||
| |||
|
|
Bob Darlington wrote: I changed the code to: Application.Printer = Application.Printers("Cheque Printer") Application.Printer.PaperSize = acPRPSUser Application.Printer.ItemSizeHeight = 5301 Application.Printer.ItemSizeWidth = 15252 Application.Printer.PaperBin = acPRBNTractor Application.Printer.BottomMargin = 1 Application.Printer.TopMargin = 1 Application.Printer.LeftMargin = 1 Application.Printer.RightMargin = 1 Application.Printer.Orientation = acPRORPortrait MsgBox Application.Printer.ItemSizeWidth & vbNewLine & _ Application.Printer.ItemSizeHeight & vbNewLine & _ Application.Printer.PaperBin & vbNewLine & _ Application.Printer.BottomMargin & vbNewLine & _ Application.Printer.TopMargin & vbNewLine & _ Application.Printer.LeftMargin & vbNewLine & _ Application.Printer.RightMargin & vbNewLine & _ Application.Printer.Orientation & vbNewLine & _ Application.Printer.PaperSize With the following result: 15252 5301 8 1 1 1 1 1 256 So it is accepting the new values, but not using them when I subsequently open the report (in Preview or normal). Whilst I want to be able to use this in a distributed mde, this testing is still being done in the mdb, so the mde is not the problem (yet). For testing purposes, the 'Cheque' report I am trying to print, is set in design mode to use the specific printer 'Cheque Printer' and paper size 'A4'. If I set the paper size to the custom for the report, it works OK in the mdb, but when I load the mde to the client PC, it resets to A4 -hence the need for this code. My current work around is to load the mdb to the client, open it in TS and reset the paper size, then make the mde on the client PC. I was hoping to overcome this cumbersome approach. Hi Bob: Hmmm...I was thinking that you said it worked if you set it manually. So I think you would like to know the values when it works. Not the above setting the values and then doing a display. I'm not sure where you got the initial values to set them to. Here's a link to MS's site. It's less than you have. Slightly different. Not as many value changes. http://support.microsoft.com/kb/284286 |
#10
| |||
| |||
|
|
I didn't see any decimal parts for a twips value tho you use one in your code. Maybe that is the problem. |
![]() |
| Thread Tools | |
| Display Modes | |
| |