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!

Suppress a field if another field is null

Status
Not open for further replies.

HoosHot

Programmer
Jan 16, 2003
41
US
Hi,
I'm trying to print an address. i.e.
Company_name
Address_line1
Address_line2
Address_line3
City, State zip5-zip4

How do I suppress address_line3 if it is null? And, by suppress, I mean don't have a blank line where address_line3 should be, but instead, move city/state/zip line up. You know? So the entire address doesn't have blank lines.

Also, how can I "combine" city/state/zip5/zip4 into one field so there aren't spaces after city and after state? You know, so the varying length of city will blend in with a comma with the state. You know? I don't want spaces after city just because the city name is small.

Lastly, probably along the same lines as the first 2 questions, how do i suppress the dash and zip4 if zip4 is null?

Thank you so much!
mnguyen_va@yahoo.com
 
Q1) Split this section into subsections for each line, and format each section to "suppress blank section.

Q2) Insert a text object and then you can drop in fields and type text (like commas and spaces) between them. It will automatically trim spaces from end of fields.

Q3) instead of using the field zip4 in the text object, use a forumla field that says:

If IsNull(zip4)
then ""
else "-" + Zip4

Put this as the last object in the text object mentioned above. Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
Thanks, Ken. You are awesome. Thanks so much for the fast reply!

:)
 
Hi Kenhamady,
I am very new to Access and I hope you can elaborate on your answer to this posting. How do I split into subsections? If I have a table with about 30 different fields ( Different phone #'s & extensions ) and many are left blank can I create subsections for each line if I don't want blank lines in my report.
Can all of this be done in a report, or should it be in a macro? (I have abbsolutely no experience with macros, but this was suggested to me.)
Your help would be greatly appreciated.
 
hi ken..
another question i have about your reply to Q1) above is that how do i format my fields now to diplay inone line if they have value- by making subsections - the filds are moved to new section so they don't line up.i am also not much experienced in CRs so please help.
Thanks
Anshu
 
Helpsig,
This is the Crystal Forum, Not the MS Access forum.

Sidanshu,
Format, Section, Highlight the appropriate Section and click the Insert button at the top.

Select the new section and click the property "Suppress blank section". Ken Hamady, On-site/Phone Crystal Reports Training/Consulting
Quick Reference Guide to using Crystal in VB
 
In Crystal reports design time set the section for suppressing the empty lines. this is way you can remove blank lines while generating crystal reports.

Krishna
 
Actually my problem is not to suppress the blank lines but - blank columns and then the column to the right of suppressed column should move to left to fill up the space(if possible).what i have now(as guided by ken is as follows)
col1 col2 col3
|---------------------
detailA | val1
detailb | val2
detailc | val3

so if there is no value for col2 , col3 should move to left
and also if all have value- now my output is not in straight line as val1 val2 val3 , but forms the diagonal appearance as defined by sections.May be i am missing something.
i hope i made myself clear now, so please let me know if it is possible to do that.
Thanks
Anshu
 
CR doesn't support this. You would have to use a cross-tab to get this behavior. Is there a reason that you can't use a cross-tab? I am sorry that I don't remember "guiding" you or your specific situation. Ken Hamady, On-site/Phone Crystal Reports Training/Consulting
Quick Reference Guide to using Crystal in VB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top