Shrink to avoid blank lines doesn't work

  • Thread starter Thread starter mogens
  • Start date Start date
M

mogens

I have set the "can shrink" option to yes for a group of address fields,
and also grouped these fields. But the shrinking does not appear.

Are there any more options to set?
 
If you have any controls on your report that are located to the right of the
field(s), they will not shrink. I haven't tested the condition if the other
fields are to the left, but suspect the same is true.
 
Jeff said:
If you have any controls on your report that are located to the right of the
field(s), they will not shrink. I haven't tested the condition if the other
fields are to the left, but suspect the same is true.
In the layout I have to follow, the customer address is displayed left,
and the corresponding delivery address right. So I suppose this is the
explanation.

Not being a MS-access wizard, are there any possible fixes for this, as
for instance:
1)Concatenating the individual address lines in the query, and then
printing the entire address string. This would require a line break
character between the individual address elements. Does such a line
break character exist, and if positive, how is it generated?

2) Would it be a solution to put the fields inside another control and
circumvent the problem this way?
 
You could concatenate the address string. However, it would be up to you,
in how you concatenated the string, to eliminate the "blanks". As far as I
know, having other controls at the same horizontal level as your "shrinking"
control basically acts to hold it open.
 
Concatenating will probably work for you. Chr(13) & Chr(10) will accomplish
what amounts to a line break. In query design view, create a concatenated
field by adding something like the following to the query design grid:

CombinedField: [FirstLineField] & Chr(13) & Chr(10) & [SecondLineField]

Bind a text box on the form to that field. Set the text box just tall
enough for one line of text, and set its Can Grow property to Yes. Set the
Can Grow property of the Detail section to Yes as needed. Note that Chr(13)
& Chr(10) needs to be in that order.

You could do the same thing by setting the Control Source of an unbound text
box to:

= [FirstLineField] & Chr(13) & Chr(10) & [SecondLineField]

In VBA vbCrLf can substitute for Chr(13) & Chr(10).

If there is the chance of blank lines they can be eliminated with an IIf
statement. Post back if you need details.
 
BruceM said:
Concatenating will probably work for you. Chr(13) & Chr(10) will accomplish
what amounts to a line break. In query design view, create a concatenated
field by adding something like the following to the query design grid:

CombinedField: [FirstLineField] & Chr(13) & Chr(10) & [SecondLineField]

Bind a text box on the form to that field. Set the text box just tall
enough for one line of text, and set its Can Grow property to Yes. Set the
Can Grow property of the Detail section to Yes as needed. Note that Chr(13)
& Chr(10) needs to be in that order.

You could do the same thing by setting the Control Source of an unbound text
box to:

= [FirstLineField] & Chr(13) & Chr(10) & [SecondLineField]

In VBA vbCrLf can substitute for Chr(13) & Chr(10).

If there is the chance of blank lines they can be eliminated with an IIf
statement. Post back if you need details.

Bruce, this solved my problem nicely. I had to make some iif's but the
result is perfect.

However, I have another place where I need to convert som html code's
into something understandable for MS-access. For instance I have this
text string where I would like to convert the <BR>'s into linebreaks in
the report:

<BR>Bitte verwenden Sie folgende Daten für die Überweisung des
Gesamtbetrages.<BR>
Als Verwendungszweck geben Sie bitte Ihren Namen und Ihre Bestellnummer
an.<BR><BR>Konto: xxxxxxx

When I do a
pay_info:
IIf([payment_info]='';'';Replace([payment_info];"<BR>";"&Chr(13)&Chr(10)"))

this just results in that the codes are being printed out.
 
If this is a one-time replacement you could probably use an Update Query.
If it is to be done continuously you would probably need some sort of
expression, but I am not aware of a Replace command. Also, I am not
familiar with wildcards in expressions, but you may find what you need by
checking Using Wildcard Characters in String Comparisons in Help. I do know
that anything enclosed in quotes in an IIf expression will be displayed as
exactly what appears between the quotes. You could also try a Google groups
search. I expect this question has been addressed from time to time.
If you seek an answer through the newsgroup you will probably do better to
start a new thread.

mogens said:
BruceM said:
Concatenating will probably work for you. Chr(13) & Chr(10) will
accomplish what amounts to a line break. In query design view, create a
concatenated field by adding something like the following to the query
design grid:

CombinedField: [FirstLineField] & Chr(13) & Chr(10) & [SecondLineField]

Bind a text box on the form to that field. Set the text box just tall
enough for one line of text, and set its Can Grow property to Yes. Set
the Can Grow property of the Detail section to Yes as needed. Note that
Chr(13) & Chr(10) needs to be in that order.

You could do the same thing by setting the Control Source of an unbound
text box to:

= [FirstLineField] & Chr(13) & Chr(10) & [SecondLineField]

In VBA vbCrLf can substitute for Chr(13) & Chr(10).

If there is the chance of blank lines they can be eliminated with an IIf
statement. Post back if you need details.

Bruce, this solved my problem nicely. I had to make some iif's but the
result is perfect.

However, I have another place where I need to convert som html code's into
something understandable for MS-access. For instance I have this text
string where I would like to convert the <BR>'s into linebreaks in the
report:

<BR>Bitte verwenden Sie folgende Daten für die Überweisung des
Gesamtbetrages.<BR>
Als Verwendungszweck geben Sie bitte Ihren Namen und Ihre Bestellnummer
an.<BR><BR>Konto: xxxxxxx

When I do a
pay_info:
IIf([payment_info]='';'';Replace([payment_info];"<BR>";"&Chr(13)&Chr(10)"))

this just results in that the codes are being printed out.
 
BruceM said:
If this is a one-time replacement you could probably use an Update Query.
If it is to be done continuously you would probably need some sort of
expression, but I am not aware of a Replace command. Also, I am not
familiar with wildcards in expressions, but you may find what you need by
checking Using Wildcard Characters in String Comparisons in Help. I do know
that anything enclosed in quotes in an IIf expression will be displayed as
exactly what appears between the quotes. You could also try a Google groups
search. I expect this question has been addressed from time to time.
If you seek an answer through the newsgroup you will probably do better to
start a new thread.
Thanks for your comments Bruce. I did of course investigate quite a lot,
but could not find a solution, and due to that this thread seemed to
have been "obsolete", I started a new thread.

Your reply would actually have done the trick, as I this evening found
out that the field in question was corrupted (some of the fields were
not <memo> but <NULL>), which caused errors. So the solution to this
problem, which need to be done continously, was to make a
replace([field];"<br>";Chr(13) & Chr(10)). Then it worked perfect.

Thanks for your help and concern. I have had a lot of good help in this
group. Makes life a lot easier for us newbies!

Mogens
 
Back
Top