• Print from ListBox (Access97)

    Author
    Topic
    #415376

    I have ListBox that populated with data from query running.
    I need to select all records in ListBox and Print those to a printer.
    I will add Print command button and write on click event.

    I’ve tried to Print Selection and Help but Debug.Print is not waht I am looking for I think…

    Thanks to all

    Viewing 0 reply threads
    Author
    Replies
    • #926190

      If you need to select all records, you might as well print the query or a report based on it. I assume that you mean a multiselect list box in which the user can select some (or all) of the items. See your thread starting at post 444826.

      • #926239

        HansV,
        there is a tool I built that do not produces any Reports, it is just conducts a search based on what entered into Search box and displayed in Listbox.
        Now ladies want to select all in listbox and print to the printer.
        I will add Print button and I am searching for the code.
        Thanks

        • #926240

          Since you populate the list box from a query, selecting all items of the list box and printing them is equivalent to printing the query. So you could open the query and print it (using DoCmd.OpenQuery and DoCmd.PrintOut), or – better – design a simple report based on the query, and print that (using DoCmd.OpenReport).

          Example with fictive names:

          Private Sub cmdPrintList_Click()
          DoCmd.OpenQuery “qryList”
          DoCmd.PrintOut
          DoCmd.Close acQuery, “qryList”
          End Sub

          or

          Private Sub cmdPrintList_Click()
          DoCmd.OpenReport “rptList”
          End Sub

          • #926294

            I am printing out a table so THANKS again!

          • #926303

            I am back…can I print table in Landscape format? There IS an option, right? I am searching, Access Help gives me code that bigger then life… I’ve tried PageSetup and Printer Properties, no luck! Thanks

            • #926311

              I don’t think you can change the printer settings for tables and queries in code – at least not easily. You can open the table or query, then issue RunCommand acCmdPrint to display the Print dialog, so that the user can set the orientation etc. But these settings will not (and cannot) be stored with the table or query. That’s why I prefer to use a report.

            • #926314

              This was a great explanation, thanks I will think about Report. Have a great day! Thanks

    Viewing 0 reply threads
    Reply To: Print from ListBox (Access97)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: