Unanswered: Don't want every item to print in a report
I have a report that produces receipts for dog show entries. In my database I have 12 different classes that can be entered but obviously not everyone enters all classes. How can I get my report(receipt) to only show those classes that a particular dog has entered. I need the 12 different classes as a dog can enter 2 classes in the same section (if that makes sense). My report also adds up the total due for the entry. At the moment the only way I can get the calculation to work is to include all the possible choices in the body of the receipt.
So at the moment a receipt may look like this
Fred The Dog Puppy class $10.00
CCD class $15.00
Best dog $5.00
Total entry cost: $30.00
I want the receipt to leave out those lines that are $0.00
I'm not good with VB so please be gentle with me.
It would help to know your table structure. At a guess, you should have a table with a record for each class entered, so in your example that customer would have 3 records in the table. With that design, you wouldn't have to worry about the zero lines, as they wouldn't exist.
i'm guessing your table probably looks like dogname, classname1, classcost1,...classname12, etc. all in one table, as opposed to having a table for the dog, and a seperate one for the classes and costs assigned to each dog.
without altering your table structures, you could try (on the report) setting the CanShrink property of each of the classname and cost textboxes to Yes, and then add some code in the Detail_OnFormat (if that's the report section they're in) event to make the classname1.visible=false if it's null, and the classcost2.visible=false if it's 0, etc.
Best idea would be to normalize the data (redesign the table structure). Poeple on here would be more than willing to help you out with that. That would enable you to pull the data you want into the query to show on the report, without having to put in the code to make things invisible.