Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 12th, 2003, 08:41 AM
Authorized User
 
Join Date: Aug 2003
Location: , , Australia.
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default Setting paper size using PrtdevMode

Hi guys....I had a problem with printing an invoice report on a continuous paper 4.75"x5.5"

Everytime users click button cmdPrintInvoice on frmOrderForm in order to print an invoice report rptInvoice based on OrderID popped up by input box(set within the query), it always prints on normal A3 paper, which is 9.5"x11"...

Even tough I have already set the paper size on the Page Setup at Report design view and Print Dialog box for printing an invoice report with the paper size 4.75"x5.5" (half A3 paper size), it's still not working ...also there was no custom paper size function on the print dialog box

So, it is possible to force printing an invoice report with the paper size 4.75"x5.5" by using VBA code or how to change the default paper size (by inch) into cm...I was thinking the problem is related with PrtDevMode by setting the PaperLength and PaperWidth...but i am still learning about VBA and confuse in setting the papersize...I desperately need some help please...

Ohh, I'm using access xp on windows 2000 and Epson LQ1050+ printer (dot matrix)...sory for very long explanation...i tried to make it as clear as possible

Thanks a million in advance for any help and advice :)

Cheers,

Fehrer
Reply With Quote
  #2 (permalink)  
Old December 12th, 2003, 12:42 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: Lehigh Acres, FL, USA.
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jemacc
Default

this may shed some light

http://support.microsoft.com/?kbid=200546

Reply With Quote
  #3 (permalink)  
Old December 14th, 2003, 12:23 PM
Authorized User
 
Join Date: Aug 2003
Location: , , Australia.
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi jemacc,

Thanks for ur advice...it's very helpful...
As I saw from the url u posted, i have made some modification to the vba coding because i'm using access xp and my printer doesn't have several paper trays....

Here is my coding...

Option Compare Database

Private Type str_DEVMODE
    RGB As String * 94
End Type

Private Type type_DEVMODE
    strDeviceName As String * 32
    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 * 32
    lngPad As Long
    lngBits As Long
    lngPW As Long
    lngPH As Long
    lngDFI As Long
    lngDFr As Long
End Type

Public Sub CheckCustomPage(ByVal rptName As String)

    Dim DevString As str_DEVMODE
    Dim DM As type_DEVMODE

    Dim strDevModeExtra As String
    Dim rpt As Report
    Dim intResponse As Integer

    ' Opens report in Design view.
    DoCmd.OpenReport rptName, acDesign
    Set rpt = Reports(rptName)

    If Not IsNull(rpt.PrtDevMode) Then
        strDevModeExtra = rpt.PrtDevMode

        ' Gets current DEVMODE structure.
        DevString.RGB = strDevModeExtra
        LSet DM = DevString
        If DM.intPaperSize = 256 Then

            ' Display user-defined size.
            intResponse = MsgBox("The current custom page size is " & _
                         DM.intPaperWidth / 254 & " inches wide by " & _
                         DM.intPaperLength / 254 & " inches long. Do you want " & _
                         "to change the settings?", vbYesNo + vbQuestion)
        Else
            ' Currently not user-defined.
            intResponse = MsgBox("The report does not have a custom page size. " & _
                         "Do you want to define one?", vbYesNo + vbQuestion)
        End If

        If intResponse = vbYes Then
            ' User wants to change settings. Initialize fields.
            DM.lngFields = DM.lngFields Or DM.intPaperSize Or _
                         DM.intPaperLength Or DM.intPaperWidth

            ' Set custom page.
            DM.intPaperSize = 256

            ' Prompt for length and width.
            DM.intPaperLength = InputBox("Please enter page length in inches.") * 254
            DM.intPaperWidth = InputBox("Please enter page width in inches.") * 254

            ' Update property.
            LSet DevString = DM
            Mid(strDevModeExtra, 1, 94) = DevString.RGB
            rpt.PrtDevMode = strDevModeExtra

            DoCmd.OpenReport rptName, acNormal

        End If
    End If

    Set rpt = Nothing

End Sub

However, when i run CheckCustomPage("rptInvoice") on the immediate window, it still did not print on 4.75x5.5" page size...was there something wrong with the vba coding...or is it because my printer EPSON LQ 1050+ does not support custom size paper?

What do u think about this?
Have anyone had experience this problem? I'm desperately need help :(

Cheers,
Fehrer
Reply With Quote
  #4 (permalink)  
Old December 14th, 2003, 06:50 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: Lehigh Acres, FL, USA.
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jemacc
Default

Check your printer documentation. There may be some escape code you may have to change.
Reply With Quote
  #5 (permalink)  
Old December 16th, 2003, 10:50 AM
Authorized User
 
Join Date: Aug 2003
Location: , , Australia.
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi jemacc,

unfortunately, my printer is quite pretty old...it's EPSON LQ 1050+ dot matrix...and i lost its documentation ...any other suggestion?

cheers,

fehrer

Quote:
quote:Originally posted by jemacc
 Check your printer documentation. There may be some escape code you may have to change.

Reply With Quote
  #6 (permalink)  
Old December 16th, 2003, 04:35 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: Lehigh Acres, FL, USA.
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jemacc
Default

Do you remember how to change the printer mode? Epson had some unique settings with thier printers. I believe you can still get the documentation. If I find the esc codes I will send them to you.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with custom paper size adrineh Crystal Reports 0 August 26th, 2006 03:21 AM
how to set the paper size in javascript sundarisekaran J2EE 1 July 15th, 2004 04:42 PM
report size according to A4 paper haahoou VB Databases Basics 1 January 25th, 2004 05:05 AM
NEED HELP on prtDevMode in setting the paper size Fehrer Access VBA 0 December 10th, 2003 07:55 AM



All times are GMT -4. The time now is 05:42 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.