Results 1 to 8 of 8
  1. #1
    5 Star Lounger
    Join Date
    Jan 2005
    Posts
    614
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Print from ListBox (Access97)

    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

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Print from ListBox (Access97)

    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>post 444826</post#>.

  3. #3
    5 Star Lounger
    Join Date
    Jan 2005
    Posts
    614
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print from ListBox (Access97)

    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

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Print from ListBox (Access97)

    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

  5. #5
    5 Star Lounger
    Join Date
    Jan 2005
    Posts
    614
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print from ListBox (Access97)

    I am printing out a table so THANKS again!

  6. #6
    5 Star Lounger
    Join Date
    Jan 2005
    Posts
    614
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print from ListBox (Access97)

    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

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Print from ListBox (Access97)

    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.

  8. #8
    5 Star Lounger
    Join Date
    Jan 2005
    Posts
    614
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print from ListBox (Access97)

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

Posting Permissions

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