'Dynamic' selection

Hartkoorn

Registered User.
Local time
Today, 11:30
Joined
Aug 12, 2006
Messages
19
Now, I don't know if this topic should be in forms, queries or reports, so I decided to post it here in general until someone gives me a big bollocking and send this topic elswhere :D

I have a table with loads (50+) of columns which hold information about people in our company.
What I want is a form? that allows me to tick the information I want and then displays the result in a report.
So, today I want a list with Name, address, town and phonenumber, but tomorrow I might need a list with Name, phonenumber, passport number and expire date.
In short, I need to make a 'dynamic'? report that displays the options I ticked out of the 50+ options (does this make sense?).
I searched for it but no luck so far.
Ta in advance
 
I think your problem is that you have to many columns in one table. There are many databases that use this type of format, it is called a "flat file format" --- like a spreadsheet really. Access doesn't handle this sort of data very well. You are better off if you normalize your database first. I think if you do that you will find your next task quite easy.
 
The problem you have is that dynamic report generation is not a trivial action. Reports, like forms, have fields that you can place dynamically - but in essence you have to build a "wizard" in your VBA code to do this.

Logically speaking, this is, indeed, an approachable task. Practially speaking, you need to be REALLY REALLY good in VBA. So before you decide you really want this, ask yourself... {Dirty Harry imitation} .... "Do I feel lucky today." Well, do you?????

In overview, your problem is TWO-fold. First, you need to consider the query that will drive the report. Second you need to consider the report itself.

If you have a list of fields that can appear on a report and use the checkbox method of selecting, that would work, though you might wish to have a second & third checkbox to note whether the information will be the basis of a sort or group operation. Eventually you could build a query string that consists of your SELECT clause and the list of fields, the FROM clause and table name (including a JOIN if that is required), and the WHERE clause with lists of criteria (if any). Plus any ORDER BY and GROUP BY clauses as determined from your other check boxes. Store the query so that you can use it as a recordsource.

So now you have the query. What next?

Well, you need to create a blank report, set up some sizing parameters, and take a shot at placement. Where there is a GROUP BY clause, you have the candidates for report headers for each grouped field. Sorting doesn't automagically imply a header, but grouping does. Things that are the basis of a GROUP BY go in either/both the header and/or footer for that group. Things that aren't associated with the GROUP BY fields go in the detail section. You need to consider for each item whether you will label it or merely present it, and you need to allow space for everything.

OK, once you have built this report, you need to save it so you can open it and print it.

Now, next trick: You have users creating ad-hoc reports all over the place. You will have a TON of obsolete objects that need to be cleaned up. You can take the approach that you never save a dynamic report or query, but then there is the question of knowing when it is safe to remove them. OR you can take the approach to just leave them where they are. In either case, you will have to compact and repair your DB frequently. You will also face serious DB "bloat" issues.

OK, there are some of your issues. Are you sure you want to do this?

The way I would do it is go to each user and say, "What reports are you going to want?" If they can't answer, they obviously haven't got a clue as to what they are asking for in terms of dynamic reporting.

Now, I should be fair about this. If you only had, say, less than 10 fields where you had any choices, it might be possible to build a "one report fits all" by using form checkbox values as part of the overall query criteria (WHERE clause stuff) defining the report. But the more fields you have that you could select, the worse this gets, and it is a problem in FACTORIAL math.

My best advice is to VERY CAREFULLY rethink this problem before you get totally overwhelmed. If you still want to do it, go for it.

The other way to do this is to allow users to get to the Access report wizards, teach them what fields they can choose, and then impose restrictions on them so that they know you will come behind them to delete EVERYTHING that isn't on the list of "approved permanent reports." Then let them struggle with it and leave you the housecleaning. This requires you to educate your uses regarding what is in your DB and how to use the Access report wizard. But your hair won't go gray as fast or get torn out as fast.
 
one other facility that I generally provide is to design a single query that draws together all the relevant inforamtion your users might need, and let them export it all into a spreadsheet. They can then decide which columns they want to see. In practice it hardly ever gets used.
 
I am looking at doing the same thing and I thinking it could be done using If statements in vb and based on the check marks chosen I would create the sql string for the list's control source. I'm not saying this is the way to do it just the way I've looked at it and to be honest I personally think its too complex and conveluded(especially if adding new search criteria later on).

So in my case I'm trying to build a list that will pull in active work orders, and then allow the user to sort out work orders by date, company, status and priority etc.. I've created a check box that actives a date input, in vb I check if the check box is selected, if it is I'd write a portion of the sql statement (this is the issue I think I'm going to have)else I'd write another sql statement.

I'm quite new to this databasing, and this just seems far too intensive if I'm going to keep adding criteria to search by. Does this sound like I'm on the right path or am I right in thinking there has to be a better way, if so an help on this topic would be great. Sorry hartkoorn wish I had the answer for you.
 

Users who are viewing this thread

Back
Top Bottom