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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Forcing new line in control in report 4

Status
Not open for further replies.

THWatson

Technical User
Apr 25, 2000
2,601
CA
I am working with a database which allows for the names of 2 adult parents plus up to 5 children. In a family listing directory, I want the report to print LastName&nbsp;&nbsp;then FirstName on lines where there are no children, but LastName then FirstName plus children's first names when there are children. But I don't want blank lines in between entries.<br>My control looks like this...<br>=Format([LastName],&quot;&gt;&quot;) & &quot;:&quot; & &quot;&nbsp;&nbsp;&quot; & [First Names] & &quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot; & IIf(IsNull([Child's Name]),&quot;&quot;,[Child's Name]) & IIf(IsNull([Child's Name 2]),&quot;&quot;,(&quot;, &quot; & [Child's Name 2])) & IIf(IsNull([Child's Name 3]),&quot;&quot;,(&quot;, &quot; & [Child's Name 3])) & IIf(IsNull([Child's Name 4]),&quot;&quot;,(&quot;, &quot; & [Child's Name 4])) & IIf(IsNull([Child's Name 5]),&quot;&quot;,(&quot;, &quot; & [Child's Name 5]))<br>and I have properties set to &quot;Can Grow&quot; and &quot;Can Shrink&quot;<br>This works alright, except I was wondering if there is any way to force the children's names onto the next line.<br>This would make an entry look like...<br>&nbsp;&nbsp;&nbsp;&nbsp;SMITH: Warner & Agnes<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Samantha, Julia, Frederick<br>rather than like...<br>&nbsp;&nbsp;&nbsp;&nbsp;SMITH: Warner & Agnes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Samantha,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Julia, Frederick<br>Any suggestions?<br>Tom Watson<br><br>
 
Test for any children and then set the control's CanShrink property?
 
Maybe I don't understand the question, but...<br><br>Use a second control for the children.&nbsp;&nbsp;Position it below the control for the parent's names.<br><br>If you don't want the blank space when there are no children, size the control so it looks like a line in design mode (the &quot;can grow&quot; property will make it visible when there is data to be displayed). <p>Jim Conrad<br><a href=mailto:jconrad3@visteon.com>jconrad3@visteon.com</a><br><a href= > </a><br>
 
My suggestion above requires a second control for the children too..
 
Thanks to both Elizabeth and Jim. You understood the problem perfectly, and the solution is exactly what I was looking for. I just never thought of diminishing the size of the control to a line, in the design mode, like that.<br><br>I keep learning more about this program all the time. Most of this stuff you never see in a manual anywhere.<br><br>Thanks again.<br>Tom
 
Just to add another little known trick-If you type out your formula, any formula, in a text box, you can type the first part then an & then a double quote, then press CTRL+ENTER then type the closing quote and then another & and then finish the formula. This will put a line break in the result.<br><br>Ex.&nbsp;&nbsp;=[firstname]& &quot; &quot; & [lastname] & &quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot; & [address]<br>
 
I was looking for the answer to this question myself, and have found it in faq181-330.
In short, what you need is to add the code:

& Chr$(13) & Chr$(10) &

Where you want the forced newline.

Svein Morten
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top