By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,480 Members | 1,606 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,480 IT Pros & Developers. It's quick & easy.

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

P: 5
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

Jan 18 '12 #1
Share this Question
Share on Google+
2 Replies

P: 759
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.

Attached Images
File Type: jpg Report.jpg (82.8 KB, 545 views)
Jan 18 '12 #2

P: 393
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.
Jan 18 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.