CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 1999
    Posts
    37

    Displaying query results



    I'm running a query from a Access Database file, and I'm trying to print out the results. Anyone know how to do this? thanks

  2. #2
    Join Date
    Apr 1999
    Posts
    16

    Re: Displaying query results



    Alex-


    I don't think there is a way to do it automatically. Try the standard VB Printer object. For example:




    With Printer

    .FontName = "Courier New"

    .FontSize = "12"


    '' Loop through a recordset

    Do While (Not rs.EOF)

    '' "With" doesn't work with Print statement

    Printer.Print Trim$("" & rs(0))


    rs.MoveNext

    Loop


    '' Print Document

    .EndDoc

    End With




    Of course, if you are just testing, it's easiest just to dump the data into a textbox to view (make sure it is set for multiple lines)...




    Do While (Not rs.EOF)

    Text1.Text = Text1.Text & Trim$("" & rs(0)) & vbCrLf

    rs.MoveNext

    Loop





    Hope this helps...

    -Jim

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

Featured