Moving fields on a report

ted.martin

Registered User.
Local time
Today, 14:09
Joined
Sep 24, 2004
Messages
743
I have a report with 3 address lines plus the city. If (say) there is no address in field address2, then I would like to move the town field up one line.

using an IF statement I guess I can check for null value but then I need to re-position the control.

Similarly if there was nothing in Address2 then I would want to move Town up 2 lines.

The field layout looks like this:

Address1
Address2
Address3
Town

Thanks
 
You could set the Can Shrink property but here's a function you can reuse.

Save this code in a Module...

Public Function acbMakeLine(varValue As Variant)
If IsNull(varValue) Then
acbMakeLine = Null
Else
acbMakeLine = varValue & vbCrLf
End If
End Function

Replace your four address controls with one single textbox, and set its control source to...

=acbMakeLine([Address1]) & acbMakeLine([Address2]) & acbMakeLine([Address3]) & acbMakeLine([Town])
 
Yes = excellent solution. I like the simplicity of it. Well done and thanks. :D
 

Users who are viewing this thread

Back
Top Bottom