Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I make different formats on the same pageof a report?

Status
Not open for further replies.

MeBeFree

Technical User
Mar 14, 2002
6
US
This seems to be a relatively simple problem. I have a table from which I get all the fields (sorted on selections by the user) though some of the fields may be null. I do not want to report the field or show the label of the null fields and I want to move up the fields below it (preferably to shorten the page and get more records on a page).

Now in my details section I have added an event procedure for the OnFormat event. In the event procedure I check the state of the field, setting the visible property and then setting the top property depending on the states of the various fields.

The problem is that format seems to stay the same for the next record, it does not start with the original format. For example say I have 4 fields, Mass and uncertainty 1 through 4. The fields are laid out on the report so that they are printed one below the other from 1 to 4.

When I open the report say the first record's Mass 1 and 4 are not null and in the second record all Mass fields have a value. I dynamically change (in the Onformat event) the format so Mass 1 prints with Mass 4 immediately below it, therefore the visible properties for Mass 2 and 3 are false cause I just set them that way. The next record the visible settings for the Mass 2 and 3 fields are still false and the Top value of field 4 is the value I set it to forthe previous record.

The format event is called for each record, Shouldn't the settings be reset since this is a new record? If not then I have to change the settings for every field for every record. This is a problem because I have multiple fields that I want to hide or display based on one fields value. There's got to be a better way. This gives "Hard coding" a new meaning.

Does anyone know of an easier way to do this?
 
Just a thought. If you don't come up with anything, and are stuck in the hard-coding-nightmare, you might cut the amount of work by using an empty string ("") instead of using the Visible property.

I'll take the (sadly rare) position that MS did do this right, though; if they did it the other way, how WOULD you make a permanent change to a property? You'd be stuck in a hard-coding-nightmare on the flip side then, I believe.

Anyway, another thought would be to gather the "reset values" (what you want them to return to) on Report_Open; and at the start of every Format, reset them (whether they need to be or not). Of course, weigh the performance hit of this; but it has the advantage of letting you, e.g., change Top from 48 to 52 in the report design interface, but not having to go find all the 48's in the code.

Good luck though. Your complaint is reasonable, though in this case I suspect "unwinnable."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top