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

Blank fields in Labels 1

Status
Not open for further replies.

idd

Programmer
Apr 19, 2002
165
GB
Hi all,

I'm Using Access 2000

What I am trying to do is print labels out for students. The fields available for address information are as follows.

Address1,
Address2,
Address3,
City,
County,
Postcode


most likley the address2 and address3 fields will not usually have data, however some address may have it.

When printing labels which will be stuck on the envelopes which go to the students with the required info. I find that the fields which are empty are still shown, on the report as blank lines.

How can I get access to move the rest of the address information up if there is no data in one of the fields.

Thanx in Advance for any help.

Idd
 
Make sure that the Can Shrink property is set to Yes for all of these controls.....
 
You're a star cosmoKramer, worked a treat and for that you deserve a star,

now what if I have something like the following will it require more work.

[field1] & "," & [field2]

if these two are empty or either one then what should I do

because if both are empty then it would produce just a comma in that line.

Thanks in Advance for any help

Idd
 
In a case like that you could do something like this:
Code:
=IIf(IsNull([field1]), "", [field1] & ", ") & [field2]
If field1 is null it will only return a null, otherwise it will return field1 and the ", "
 
Thanx Again CosmoKramer,

Now if I use the second method you gave, then if both fields are empty it shows a blank line as was my initial problem.

I want to conserve space as the labels aren't extremely big and place two fields which are commonly, but not always, found empty, on one line.

If per chance I find that both fields are empty in a particular record it will show up as an empty line, even though the Can Shrink is set to yes.

Any help will be appreciated

Idd
 
That syntax works for me, and in fact I just tested it to make sure. Do you have another control horizontally to the left or right of this text box?? If so, the CanShrink property won't work....
 
CosmoKramer,

You are, once again, right. it did work. I got into work this morning (UK time) and found your response, tried it again, and it worked. Dont know why it didn't yesterday.

I appreciate your help and your time.

Thank you very much.

Idd
 
Hi All

Just a pointer for me (and anyone else who is having label problems) to find a post written by mstrmage which solved this problem another way. CosmoKramers Idea worked, but when I tried it on another report it just wouldnt work, I don't know why, but MstrMage has another solution which works quite well,

thread703-285669


Thanks once again to CosmoKramer and now also to MstrMage for your time and help.

Idd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top