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!

If report txt box null how do I move other controls below it up. 1

Status
Not open for further replies.

Triacona

Technical User
Jun 11, 2009
462
GB
Dear All,

I have a report - PolAcknowledgementLetter

It has fields:
Code:
txtFullName with control source as:=IIf([FullName]="","Owner/Occupier,",[FullName])
CompanyOrganisation with control source as:CompanyOrganisation
txtAddress1:with control source as:=IIf(IsNull([AgentAddress1]),[Address1],[AgentAddress1])
txtAddress2:with control source as:=IIf(IsNull([AgentAddress1]),[Address2],[AgentAddress2])
txtAddress3:with control source as:=IIf(IsNull([AgentAddress1]),[Address3],[AgentAddress3])
txtAddress4:with control source as:=IIf(IsNull([AgentAddress1]),[Address4],[AgentAddress4])
txtAddress5:with control source as:=IIf(IsNull([AgentAddress1]),[Address5],[AgentAddress5])
txtPostalCode:with control source as:=IIf(IsNull([AgentPostalCode]),[PostalCode],[AgentPostalCode])
It is in a letter format, i.e. one page per Customer...it is an aknowledgement letter.

So not all of the address lines are always filled, and the CompanyOrganisation is not always filled in.
So there are blank lines.
How do I if the txt box is null move the control below it up?
I was thinking VB:
Code:
for i = 1 to 5 do
    i = 1
    x = 2
If IsNull(txtAddressi) then
   Move Addressx up to replace Addressi
else nothing.
end for

Please help, with above problem or if you have a better idea I'd really appreciate it![bigsmile]
Thank you![smile]

Thank you,

Kind regards

Triacona
 
I think you are working way too hard. Do you understand that Null is not the same as ""?

Consider replacing:
Code:
=IIf([FullName]="","Owner/Occupier,",[FullName])
=IIf(IsNull([AgentAddress1]),[Address2],[AgentAddress2])
with
Code:
=Nz([FullName],"Owner/Occupier,")
=Nz([Address2],[AgentAddress2])
This assumes one or the other might have a value.

You can set the controls' Can Shrink property to Yes to move controls under it up. This will not work if you have other controls to the left or right of the Can Shrink control.


Duane
Hook'D on Access
MS Access MVP
 
Dear Duane,

I'd say you're working really hard too.[smile]
Thank you ever so much for all your help over the past few days![bigsmile][2thumbsup]
Thank you for the advice on the null values I will use it, like with my addresses, your code looks more succinct.

Your suggestion on the can shrink property works brilliantly![bigsmile]
Thank you! A simple succint answer!
Thank you again!
Have a star!

Thank you,

Kind regards

Triacona
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top