Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2008
    Posts
    28

    Unanswered: how to print the contents of a multi-column listbox?

    I am trying to make a command button that will print the contents of a listbox which has several columns and potentially several records, so i would like the code to do it relatively quickly... i can get it to print the list of the bound columns easily by just creating a long printstring, but i need the other columns.


    does anyone know an easy way to do this? should i create some sort of report?

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Yes. Create a report that has a Record Source that matches the SQL in the Row Source of the list box and print that.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Jun 2008
    Posts
    28
    but what if im using the recordset property to populate the list? should i set it equal to the recordset instead? Is there a way i could print the recordset directly?

  4. #4
    Join Date
    Jun 2008
    Posts
    28
    anybody? i cant set the record source to the recordset of the listbox because they arent the same... and the rowsource property is null... how can i make the report look at that record source?

  5. #5
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    the strict answer to the stated question is yes:

    dim r as integer 'rows
    dim c as integer 'columns
    with forms!whateverTheFormIsCalled.whateverTheListIsCal led
    for r = 0 to .listcount-1
    for c = 0 to .columncount-1
    debug.print .column(c,r) 'do something more useful here
    next
    next
    end with

    izy

    make allowances for this sites anoying habit of inserting a space after 50 chars: Called ~ Cal<space>led
    currently using SS 2008R2

Posting Permissions

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