cancel
Showing results for 
Search instead for 
Did you mean: 
The HP Calculator Community Message Board is moving. While we prepare for the move, we are unable to accept new postings. During the move, you can look for help from other users by visiting https://www.hpmuseum.org/ . Or if you need technical support for your calculator visit: HP Calculators. .
ArchivedThis topic has been archived. Information and links in this thread may no longer be available or relevant. If you have a question create a new topic by clicking here and select the appropriate board.
AlexTeslin
New member
6 2 0 0
Message 1 of 3
1,618
Flag Post

Printing duplex programmatically using VBA in Microsoft Access

HP Recommended

Hi, I am trying to print in duplex mode programmatically  from Microsoft Access using VBA.  Printer model I am using is: (HP LaserJet P4010_P4510 Series PCL 6).

 

This problem has to do with this printer model or it's driver as I am can successfully print duplex on another printer.

 

Can anyone suggest any thoughts to resolve the issue ?

 

Thank you 

2 REPLIES 2
AlexTeslin
Author
New member
6 2 0 0
Message 2 of 3
Flag Post
HP Recommended
I just did some tests and found that I cannot even print duplex manually in Word doc. I can print in MS Access though. This is weird.

Any suggestions please ?
Was this reply helpful? Yes No
Cvajniga
Level 1
8 5 0 0
Message 3 of 3
Flag Post
HP Recommended

I've spent ages to find a solution for duplex printing on HP printers. Can't make it work on the following ones:

HP LJ 1010

HP LJ 1012

HP LJ P1006
HP LJ P2015n
HP LJ P2015dn

 

My code works fine with Epson, Kyocera & Canon printers.

Public Function fncSetPrint(Rpt As Report) As Integer
Dim locINI As String, s As String

   On Error GoTo fncSetPrint_err

   locINI = gPath & "INI\Print.ini"

   fncSetPrint = 1

   s = GetIniString("MAIN", "Duplex", locINI, 1) 'uses GetPrivateProfileString
   'acPRDPSimplex = 1
   'acPRDPHorizontal =  2
   'acPRDPVertical = 3
   Select Case s
      Case "": 'nothing to do
      Case "1": Rpt.Printer.Duplex = acPRDPSimplex
      Case "2": Rpt.Printer.Duplex = acPRDPHorizontal
      Case "3": Rpt.Printer.Duplex = acPRDPVertical
   End Select

  fncSetPrint = 0

fncSetPrint_exit:
   On Error Resume Next
   Exit Function

fncSetPrint_err:
   ErrMsg "modPrint - fncSetPrint"
   Resume fncSetPrint_exit

End Function

 I hope you've got the idea. The setting is stored in an INI-file, see variable s.

I call the fncSetPrint from Report_Open. It works fine in other scenario as well:

 

Dim rpt As Report
   
   DoCmd.OpenReport "myReport", acViewPreview
   Set rpt = Reports("myReport")
   fncSetPrint rpt

 Unfortunatelly, HP printers don't do what they're supposed to. 😞

 

I'm stuck.

Can anyone help, please? Thank you very much for your time in advance.

Was this reply helpful? Yes No
ArchivedThis topic has been archived. Information and links in this thread may no longer be available or relevant. If you have a question create a new topic by clicking here and select the appropriate board.
† The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation