Results 1 to 2 of 2

Thread: Print Grid on the Printer (2)

  1. #1

    Thread Starter
    Hyperactive Member Matt-D's Avatar
    Join Date
    Nov 1999
    Location
    Mettmann, Germany
    Posts
    305

    Post

    English:
    There is a grid filled by an Access 1.10 database and I want to print it out on the
    printer, but with the method I know the printer only gives out an empty paper:

    Printer.Print Grid1
    Printer.EndDoc
    How must I write the code (in VB3, but normally this doesn't matter)

    Thanks for some help, Matthias

    Deutsch:
    Die Tabelle in meier Form wird über Access 1.10 gefüllt und nun möchte ich die
    Ergebnisse ausdrucken, aber mit der Methode die ich kenne (s.o.), kommt nur ein leeres Blatt.

    Was muß ich hier tun (VB3)

    Danke für ein paar Tips, Matthias

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    I'll assume you're using a Databound Grid..
    The easiest method would probably be just to traverse the underlying Recordset and print the Data directly from there, something like:
    Code:
    Private Sub Command1_Click()
        Dim X As Integer
        Dim Y As Integer
        
        Printer.FontName = "Courier"
        With Data1.Recordset
            For Y = 0 To .RecordCount - 1
                For X = 0 To .Fields.Count - 1
                    Printer.Print .Fields(X).Value; " ";
                Next
                Printer.Print
            Next
        End With
    End Sub
    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width