View Full Version : Ignore Blanks When Printing Reports


scouser
01-10-2004, 08:03 AM
Guys, I want to format my forms better. I have various address fields in my Invoice Report.
AddressField1
AddressField2
AddressField3

However there is not always data in these fileds i.e. AddressField3 usually blank. So when I print an Order the blanks look a bit messy? Is there any way you can tell access to reformat the form to ignore blank fields or do I just accept the blanks!!
Cheers in advance,
Phil.

llkhoutx
01-10-2004, 09:44 AM
Select the report textbox CanGrow/Canshrink properties and set them to True. Be sure that the textboxes do not overlap.

WayneRyan
01-10-2004, 04:07 PM
Phil,

Do any of these help?

http://www.access-programmers.co.uk/forums/search.php?s=&action=showresults&searchid=287082&sortby=lastpost&sortorder=descending

Wayne

scouser
01-11-2004, 10:35 AM
Thanks guys. I set Can Grow / Can Shrink properties to 'Yes' on the text box (address fields) on the report. Still printing blanks because I guess I haven't done it right!! How would you explain the procedure to a small child! Ha! Ha!
Once again, thanks guys.
Phil.

WayneRyan
01-11-2004, 10:55 AM
Phil,

Lets say that you have an address:

Name
A1
A2
City

Just to keep the names short. If address line 2 (A2)
is sometimes blank, then you can use an Iif Statement
to give you a one-field address. This is a NEW column
in your query and your report should reference it.

NewCol: Iif(IsNull(A2),
Name & Chr(10) & Chr(13) &
A1 & Chr(10) & Chr(13) &
City,
Name & Chr(10) & Chr(13) &
A1 & Chr(10) & Chr(13) &
A2 & Chr(10) & Chr(13) &
City)

That would be typed in all on one line, I just formatted
it for readability.

If A2 is Null (blank) Then the NewCol has Name,A1,City
otherwise it has Name, A1, A2, City. The new field can
then be references in your report as ONE field.

Oh, the Chr(10) & Chr(13) are Carriage Return/LineFeed.

Wayne

scouser
01-11-2004, 11:56 AM
Thanks for your time and efforts Wayne. I have typed the following in my InvoiceQuery:

NewCol: IIf(IsNull(AddressLine2), CustomerName & Chr(10) & Chr(13) & AddressLine1 & Chr(10) & Chr(13) & City, CustomerName & Chr(10) & Chr(13) & AdressLine1 & Chr(10) & Chr(13) & AdrdressLine2 & Chr(10) & Chr(13) & City, CustomerName & Chr(10) & Chr(13) & AddressLine1 & Chr(10) & Chr(13) & AddressLine2 & Chr(10) & Chr(13) & AddressLine3 & Chr(10) & Chr(13) & City)

I get an error, wrong number of arguments in expression?

What do you think.
Phil.

scouser
01-11-2004, 12:11 PM
Tried your expression (changed names accordingly) & still got an error. Error stated that specified field [AddressLine2] could refer to more than one table in From clause of your SQL statement?

Not much of a coder myself!!
Cheers,
Phil.

scouser
01-11-2004, 12:22 PM
Tried the following in the record source for a single text field on the Invoice Report:

=[CustomerName] & Chr(13) & Chr(10) & [AddressLine1] & IIf(IsNull([AddressLine2]),"",[AddressLine2] & Chr(13) & Chr(10)) & IIf(IsNull([CustomerCity]),"",[CustomerCity] & Chr(13) & Chr(10)) & IIf(IsNull([CustomerCounty]),"",[CustomerCounty] & Chr(13) & Chr(10)) & IIf(IsNull([CustomerPostCode]),"",[CustomerPostCode])

Access prompted me for inputs for AddressLine1 & AddressLine2 & PostCode?? Then output the Company Name (which was correct) and the 2 values I entered for the address Lines then the correct County & correct City then the value I entered for the PostCode?

So I got the following output:
Pro-Val
11
Biggleswade
Beds
1

When this eventually works can each address field that does print have a label assigned to it or not?
Tricky this programming game!!
Cheers,
Phil.

Rich
01-11-2004, 03:06 PM
Without using reams of code you'll have to use the can shrink method if you want the labels to show also

scouser
01-12-2004, 01:03 AM
Thanks for the reply Rich. Can you see from the thread above your reply,the reason why Access is asking for data input regards the address 1 & 2 Fileds plus the PostalCode when the Invoice report is run?
Phil.

Rich
01-12-2004, 01:15 AM
Because you do not have those fields in your Report. Wayne was just giving an example. Re-name the code with your fields

dan-cat
01-12-2004, 02:23 AM
Originally posted by llkhoutx
Select the report textbox CanGrow/Canshrink properties and set them to True. Be sure that the textboxes do not overlap.

You also need to make sure that the header,footer or detail section where your fields are located, can grow/shrink properties are set to true.;)

Dan

scouser
01-12-2004, 03:11 AM
Dan you must be getting sick of me!!
I will have a play about tonight, make sure the Can Grow / Can Shrink is set appropriately!! As for the other code.......Rich I do have all those fields in my Report:

1)CustomerName
2)AddressLine1
3)AddressLine2
4)AddressLIne3
5)CustomerCity
6)CustomerCounty
7)CustomerPostalCode

When I put in code as previous thread it outputs a few of the fields OK for: 1 - 5 & 6 but not for 2-3 &7 where the user is prompted to enter values for these fields?

Sorry to go on..................probably obvious to you guys!!
Cheers,
Phil.