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!

New Line for each Field in a Report... 2

Status
Not open for further replies.

ashmanuk

Technical User
Aug 5, 2004
23
US
Hi there, I have a report that shows multiple fields in a text box. This works fine using the =[field1] & [field2] etc...

However I was wondering if anyone knew of a way to make the next field appear on a new line as this would make my report look a lot neater and easier to read! I cant find any code for a new line anywhere and was just wondering if anyone knew it or knew of another way to do this!

I have tried =[field1] & " " & [field2] but because the fields change in size this crude method does not work very well! I have also tried pressing enter within the quotation marks, but this just displayes a strange looking square on the report.

Thanks for any help...
 
If you put a new text box for each field and place then as you want on the report, this will work.
Ken

- If you are flammable and have legs, you are never blocking a fire exit.
Mitch Hedburg
 
That is originally how the report was set up, however the these fields are arranged above each other like this (headings 3 and 4):

Heading1 Heading2 Heading3 Heading4
[fielda] [fieldb] [field1] [field4]
[field2] [field5]
[field3] [field6]

Fields 2,3,5&6 do not always contain anything however, so I put them all into one text box and enabled the Can Grow and Can Shrink options so that no spaces would appear if the fields were empty.

This works fine, but I just need to know how i can space it out to make it look better!

Thanks for your help...
 
You could still use the can grow and can shrink on the individual boxes. I do reports that use currency alot, and I just have it display a placeholder if there is no data, i.e. "$0.00". Maybe someone else can address this for you.
Ken

- If you are flammable and have legs, you are never blocking a fire exit.
Mitch Hedburg
 
OK, thanks for your help, I could not use the individual fields though because then I would have to make room for them in the Detail and the space would be there even if there was nothing being displayed!

Also, having a placeholder for a blank field in this case would not work, as there are a lot more blanks than not which would make the report look aweful!

Thanks anyway though!
 
I'm not the one to describe how to do this because I'm struggling with it myself....

But if you show the fields that might not have data in their own SubReports, then you can place code to cause a SubReport to not be shown if there is no data. You have to place the code in the main report's detail event property.

An example of the code is:

Code:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
    Me.oneSubReport.Visible = Me.oneSubReport.Report.HasData
End Sub
 
Sorry for taking a while to reply..

I understand what you are saying Zoller, but I dont think this will work either for the same reason that I would have to leave sufficient space in the detail section of the report for the sub report to be dispalyed if there is data there.

The only way I think I can get around the problem is what I tried in my original post(using multiple fields in the one text box, telling it to grow if there is data in it). The thing is I still have not found the code to make the next field appear on a new line to make the spacing appear correct.

Thanks for the posts I have had so far and I appreciate any more info anyone out there has!

Cheers
 
In my experience if there's no data, there's no space used by the subreport. Give a try and let us know how it goes. I understand your skeptism because I didn't think it would work either.
 
Ha ha, well at least your honest, ill give it a go now then matey
 
I have tried setting up the sub reports, and it looks like it might work, however I am unsure about how to link the report and subreport to bring up only the fields required for that entry rather than all the records in each sub report! Hope that makes sense?!
 
Hello again, I eventually got the sub reports working but as suspected by both of us it didn't solve the spacing issues I was having!

However, I have now found the code required to force a new line within a text box, entering Chr(13)& Chr(10)will force a new line:

=[Field1]& Chr(13)& Chr(10) & [Field2]

This displays:
[Field1]
[Field2]

Hope this helps anyone having similar problems
 
Wow, sorry about that.

I'm still having trouble with this too. It seems as though the "can shrink" and "can grow" properties have some effect on the amount of space taken up, but the results have been very inconsistent for me. Sometimes I can get the space to collapse and sometimes I can't.

And, as you say:
I am unsure about how to link the report and subreport to bring up only the fields required for that entry rather than all the records in each sub report!
There seems to be extra space allowed for other rows in the source data table when that other data in the same column is the same, even if it's not displayed. Pretty freaky.


I'd be great if someone who understood this well would write a FAQ on how to do this.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top