UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> How To Omit Blank Fields In The Report, Office 2007    
 
   
infobroker
post Apr 23 2012, 03:04 PM
Post #1

UtterAccess Enthusiast
Posts: 51



Dear,

I have the table with following fields: Authors, Title, Description, Other_names, Other_titles. I would like to create reports consisting all mentioned fields, but some fields are sometimes blank, e.g. Other names or Other titles. Is there a way to omit these blank fields in the final rtf report?

I would very appreciate for your help.

Regards,

Adam

This post has been edited by infobroker: Apr 23 2012, 03:10 PM
Go to the top of the page
 
+
pere_de_chipstic...
post Apr 23 2012, 03:28 PM
Post #2

UtterAccess VIP
Posts: 7,590
From: South coast, England



Hi Adam

How do you mean by 'Omit them'?

To reduce any vertical space you could sert the Can gow and Can Shrink propreties of the text boxes:
1. If you have any labels associated with these fields you need to replace them with text boxes
2. For these label text boxes you will need to set the Control source to =IIF([SomeFieldName]="","","TheLabelText")
3. Set the Can Grow and Can Shrink properties of all the text and 'label' text boxes to 'Yes':
4. Set the Can Grow and Can Shrink properties of the report section the text boxes appear in, to 'Yes'

This will reduce the vertical size of the section they appear in, if the fields are vertical placed (e.g.):
QUOTE
Author: Isaac Asimov
Title: I Robot
Description: Sci Fi,
Other_names:
Other_titles: Caves of Steel, Foundation, ....


Then any blank lines would disappear e.g. the above 5 lines would appear as
QUOTE
Author: Isaac Asimov
Title: I Robot
Description: Sci Fi,
Other_titles: Caves of Steel, Foundation, ....


However e.g. if the record looks like:
Authors, Title, Description, Other_names, Other_titles
ie, in a horizontal line, then if there is any text in any of these fields there will be no effect.

You could use code to reposition and resize each of the text boxes but IMHO this would probably not be worth the effort!

hth
Go to the top of the page
 
+
doctor9
post Apr 23 2012, 03:34 PM
Post #3

UtterAccess VIP
Posts: 9,300
From: Wisconsin



Adam,

Since this report is going to be output to .RTF format, there's one way you could do it I can think of.

Create a new query field in the query that drives the report, called "strOutput". This will be a calculated field with this sort of calculation:

=[Authors] & vbCrLf & [Title] & vbCrLf & [Description] & vbCrLf & Nz([Other_names], "") & vbCrLf & Nz([Other_titles], "")

The "vbCrLf" bit is a shortcut for "Carriage Return/Line Feed", or "start a new line of text".

This is assuming that each field is currently on it's own line in the report. If you have Authors and Title on the same line, you can replace vbCrLf with a single space like this: " "

Now, since you might end up with two "new lines" in a row, you need to create a second calculated field that deals with that;

strOutputFixed: Replace([strOutput],[vbCrLf] & [vbCrLf],[vbCrLf])

This should clean up your output. Note: At this point, I'm assuming that the only fields that might be empty are "other names" and "other titles". If I'm wrong, let me know.

Open your query in Datasheet view, and expand the row height to see the multiple rows, to make sure it looks right to you.

Once you've got your calculated fields done, go to the report and remove all of the textboxes bound to the fields you've now consolidated into a single calculated field. Create a single textbox that is bound to strOutputFixed. Make sure it's wide enough to display the widest possible text, but only make it ONE line of text tall. Set the Can Grow property of this textbox to TRUE.

Now the report will expand the textbox vertically to make it as tall as it needs to be, leaving no blank lines in the middle of a record. That should do it.

Hope this helps,

Dennis
Go to the top of the page
 
+
infobroker
post Apr 24 2012, 03:53 PM
Post #4

UtterAccess Enthusiast
Posts: 51



Hi Bernie and Dennis,

thank you very much for your responses and advices. They are extremely valuable for me.

Kind regards,

Adam
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 23rd May 2013 - 09:41 PM