By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,124 Members | 2,208 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,124 IT Pros & Developers. It's quick & easy.

Print to a specific Bin MS Access

P: 37
Hello. I'm stuck. I've got a form I need to print to a manual feeder on a shared laser printer. This will get me to the printer but I can't seem to figure out how to print it to a specific bin. The .PaperBin appears to be nonfunctional (all things give me the same result). I took a look at the .prtDevMode and decided it was over my head. Platform is Access 2003 in an XP Enviorment.
Expand|Select|Wrap|Line Numbers
  1. 'prints a hard copy to a specific printer name
  2. 'or default printer if that doesn't exist
  3.  
  4.     Dim prtFirst As Printer
  5.     counter = 0
  6.     While counter <= Application.Printers.Count - 1
  7.        Set prtFirst = Application.Printers(counter
  8.        'if it is the right printer
  9.        If prtFirst.DeviceName = "hp LaserJet 1320 PCL 5e" Or prtFirst.DeviceName = "\\LW706\hp LaserJet 1320 PCL 5e" Then
  10.  
  11. prtFirst.PaperBin = acPRBNEnvelope
  12. Forms("frmEXCALLBL").Form.Printer = prtFirst
  13.          'set up form to use that printer and exit loop
  14.        counter = Application.Printers.Count
  15.  End If
  16.        counter = counter + 1
  17.     Wend
  18.     'make sure that form is selected
  19.     DoCmd.SelectObject acForm, "frmEXCALLBL", True
  20.     'print the form
  21.     DoCmd.PrintOut
  22.     'darn thing keeps reapearing
  23.     Call Hide_DBWinDOW
  24.  
Aug 9 '07 #1
Share this Question
Share on Google+
5 Replies


FishVal
Expert 2.5K+
P: 2,653
Hello. I'm stuck. I've got a form I need to print to a manual feeder on a shared laser printer. This will get me to the printer but I can't seem to figure out how to print it to a specific bin. The .PaperBin appears to be nonfunctional (all things give me the same result). I took a look at the .prtDevMode and decided it was over my head. Platform is Access 2003 in an XP Enviorment.
Expand|Select|Wrap|Line Numbers
  1. 'prints a hard copy to a specific printer name
  2. 'or default printer if that doesn't exist
  3.  
  4.     Dim prtFirst As Printer
  5.     counter = 0
  6.     While counter <= Application.Printers.Count - 1
  7.        Set prtFirst = Application.Printers(counter
  8.        'if it is the right printer
  9.        If prtFirst.DeviceName = "hp LaserJet 1320 PCL 5e" Or prtFirst.DeviceName = "\\LW706\hp LaserJet 1320 PCL 5e" Then
  10.  
  11. prtFirst.PaperBin = acPRBNEnvelope
  12. Forms("frmEXCALLBL").Form.Printer = prtFirst
  13.          'set up form to use that printer and exit loop
  14.        counter = Application.Printers.Count
  15.  End If
  16.        counter = counter + 1
  17.     Wend
  18.     'make sure that form is selected
  19.     DoCmd.SelectObject acForm, "frmEXCALLBL", True
  20.     'print the form
  21.     DoCmd.PrintOut
  22.     'darn thing keeps reapearing
  23.     Call Hide_DBWinDOW
  24.  
Hi, Carl.

Just a guess.
Access has predefined constants for 14 bin types. Your bin may have printer specific number (>=256).

Value Meaning
1 Upper or only one bin
2 Lower bin
3 Middle bin
4 Manual bin
5 Envelope bin
6 Envelope manual bin
7 Automatic bin
8 Tractor bin
9 Small-format bin
10 Large-format bin
11 Large-capacity bin
14 Cassette bin
256 Device-specific bins start here
Aug 9 '07 #2

P: 37
Anyplace to look that up in Windows?
Aug 9 '07 #3

P: 37
The answer was 257. I found it by changing my default method of printing to that tray and poping what that Bin was to the screen. Then I just hard coded it. Took me three days to think of that. Doh!
Aug 14 '07 #4

FishVal
Expert 2.5K+
P: 2,653
The answer was 257. I found it by changing my default method of printing to that tray and poping what that Bin was to the screen. Then I just hard coded it. Took me three days to think of that. Doh!
Nice.
I'm glad you've made it working. And thanks for that you've posted the solution.
Aug 14 '07 #5

P: 37
As a fun addition 257 didn't work on everyones system. For some reason one (and only one) older computer wouldn't take any values about 256. I ended up on that one old computer creating a separate printer (exactly like the first but only the correct tray selected). I then just on his computer made it so it will check to see if that printer exist and then print to it. If that specific printer doesn't exist just find the standard one and Print to it with the standard printer with 257 as the bin number.
Aug 28 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.