Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access 2000: Print Report to Thermal 80mm Receipt Printer

Status
Not open for further replies.

brianell

Vendor
Mar 14, 2009
1
A2
Hi,

I am using a POS system I wrote 2 years back in Access 2000

I have acquired a thermal receipt printer for my POS program. It prints on a 80mm wide strip of thermal paper. It's drivers offer certain paper sizes and cut options which Access 2000 does not seem to like. I get a message "cant print or preview because the page size you selected is larger than 22.75 inches", which it isn't I gather from hours of googling, this a default error message for page sizes that are not supported by Access.

I gather the solution to my problem is in a VBA module, but I have no idea how to fix this. Any Help will be greatly appreciated.

I gather this is what I need, but have no idea how to modify this to suit a "page" of 80mm x 3276mm (roll length).

Code:
Option Compare Database
Option Explicit
'*********************************************
' Author:  Jim Bonacorda, MIS
' Phone:  732-721-5544 ext 3166
' E-mail: jbonacorda@sabert.com
' Created:  11/20/2002
' The purpose of this module is to manage the
' printer settings for reports in this application
'*********************************************
Const MOD_NAME$ = "Module modPrinterMgmt"

Type str_DEVMODE
    RGB As String * 94
End Type

Type type_DEVMODE
    strDeviceName As String * 16
    intSpecVersion As Integer
    intDriverVersion As Integer
    intSize As Integer
    intDriverExtra As Integer
    lngFields As Long
    intOrientation As Integer
    intPaperSize As Integer
    intPaperLength As Integer
    intPaperWidth As Integer
    intScale As Integer
    intCopies As Integer
    intDefaultSource As Integer
    intPrintQuality As Integer
    intColor As Integer
    intDuplex As Integer
    intResolution As Integer
    intTTOption As Integer
    intCollate As Integer
    strFormName As String * 16
    lngPad As Long
    lngBits As Long
    lngPW As Long
    lngPH As Long
    lngDFI As Long
    lngDFr As Long
End Type

Sub sSwitchPaperSizeToLegal(rptName As String)
'The purpose of this sub is to set the page size
'for a report to legal
Const SUB_NAME$ = "sSwitchPaperSizeToLegal"
Dim DevString As str_DEVMODE
Dim DM As type_DEVMODE
Dim strDevModeExtra As String
Dim rpt As Report

    'Open report in design view.
    DoCmd.OpenReport rptName, acDesign    'Open report in Design view.
    Set rpt = Reports(rptName)
    If Not IsNull(rpt.PrtDevMode) Then
        strDevModeExtra = rpt.PrtDevMode   ' Get current DEVMODE structure.
        DevString.RGB = strDevModeExtra
        LSet DM = DevString
        DM.lngFields = DM.lngFields Or DM.intPaperSize Or DM.intPaperLength Or DM.intPaperWidth
        DM.intPaperSize = 5    'legal
        DM.intPaperWidth = 8.5 * 254    '8.5 inches
        DM.intPaperLength = 14 * 254  '14 inches
        LSet DevString = DM    'Update property.
        Mid(strDevModeExtra, 1, 94) = DevString.RGB
        rpt.PrtDevMode = strDevModeExtra
    End If
    DoCmd.Close acReport, rptName, acSaveYes

End Sub
Brian
Mutare
Zimbabwe (Don't ask!!!!
smiletiniest.gif
)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top