Results 1 to 3 of 3

Thread: Print grid on the printer - Help !!!!!!

  1. #1

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

    Post

    There is a grid (standard project, normal VB-grid) filled by an Access 1.10 database (SQl) 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

    What have I to do here (!!VB3!!) ???????
    I'm asking and asking again, perhaps someone knows ,) .........

    If you have any questions you cand semd me an eMail.

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

    Post

    You definitely need to upgrade to at least VB5..

    As the other methods we've suggested don't seem to have worked for you, lets try accessing the Data directly from the Access DB and forget the Grid, ie.
    Code:
    Private Sub Command1_Click()
        Dim oDB As Database
        Dim oRS As Recordset
        Dim iField As Integer
        
        Set oDB = OpenDatabase("C:\Files\Db1.mdb")
        Set oRS = oDB.OpenRecordset("SELECT * FROM MyTable", dbOpenForwardOnly)
        While Not oRS.EOF
            For iField = 0 To oRS.Fields.Count - 1
                Printer.Print oRS(iField) & "   ";
            Next
            Printer.Print
            oRS.MoveNext
        Wend
        Printer.EndDoc
        oRS.Close
        oDB.Close
        MsgBox "All Done", vbInformation, "Print Data"
    End Sub
    This may need some Formatting, but at least it will get it out onto the Printer.

    ------------------
    Aaron Young
    Analyst Programmer
    aarony@redwingsoftware.com
    ajyoung@pressenter.com


  3. #3
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,175

    Post

    Besides upgrading to VB5 or 6, he will need to use MSFlexGrid (or some third party grid) rather than the MS Grid control he is now using. When I first saw his question I thought the answer would be a simple MyForm.PrintForm which (after hiding the other non-Grid objects) works just fine in one of my projects that uses a flex grid. When I tried it with the old MS Grid however, the contents of the grid did not show up.

    ------------------
    Marty

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