Allowing users to select column from a table to print report.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • microsoftsucks
    New Member
    • Jan 2012
    • 5

    Allowing users to select column from a table to print report.

    I have two forms. One form is where user enters the search criteria and then on the second form he sees the search results where he has the ability to update, delete the records.

    My question the table has 18 columns and it is not possible to fit all those columns on the report. I am looking for a solution where after the results of the query has been viewed in the bottom of the form the user could select the columns on the results form and view the report. Or when the user is entering search criteria I ask him to select the columns he wants on the report. Is this something that can be done in VB and Access

    Thanks
  • Mihail
    Contributor
    • Apr 2011
    • 759

    #2
    Hi !
    Is possible to fit all your columns in the same report.
    Of course, not horizontally. If you move the controls one under other one you can obtain a report with only 9 "columns". If you put 3 controls on the same vertical you can obtain a report with 6 "columns" and so on.

    I have attached a picture from one of my reports where I have 15 columns from database but I display all of them using 5 columns in report.
    Hope you understand the idea, because my English is...

    I think that you can accomplish the task you are asking for: to select columns to be included in the report. But is a hard work to code that.
    [IMGNOTHUMB]http://bytes.com/attachments/attachment/5955d1326876399/report.jpg[/IMGNOTHUMB]
    Attached Files
    Last edited by NeoPa; Jan 18 '12, 06:19 PM. Reason: Made pic viewable

    Comment

    • dsatino
      Contributor
      • May 2010
      • 393

      #3
      First, if only to amuse myself, 'microsoftsucks ', yet here you are... :)

      Now, to answer your question: Yes, but as Mihail suggests it's a bit of work. If you're inexperienced, it's a lot of work.

      In general:
      1. You need a way for the user to select the columns. The simplest way is probably a list box in which the user can select multiple items. You only have so many controls on your report though so now you must have something in place to ensure the user doesn't select too many.

      2. You then need code to dynamically rewrite the recordsource of the report or the query that the report uses as a recordsource. I prefer to use a query because I can view it without having to open the report, but that's up to you.

      3. Then you need to code to clear all the controlsources of your report controls and code to rewrite them.


      Not terribly complicated, but your level of experience will come into play.

      Comment

      Working...