Detail Height

J

Jemsson

Hello

I have report that I use print by VB Event / on Format

Well, When I print so some post have more than 1 raw and that make problem
with Detail Height, cause Detail know ONLY data on TextBox.
So I made empty TextBox with name: CanGrow

I try to make own code and it works, but the problem is:
Slowly and the other problem is the result of Height shows on next post
instead on current post!

----------------------
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim Number, Words, TheRaw As Integer

TheRaw = 0
Number = Len(strLast) ‘strLast data coms from VB print

For Words = 1 To Number Step 1
If Left(Mid(strLast, Words), 1) = vbCr Then
TheRaw = TheRaw + 1
End If
Next Words

If Not TheRaw = 0 Then
Me.txtGrow.Height = 500 * TheRaw
End If
End Sub
-----------------------

I know this code I created is not the best, because it take long time when
open report.

Do you have any idée to calculate how many VbCr and then make
Me.TextGrow.Hieght = ….. on only current post ?

So In this TextGrow.Height will give enough space on Detail to show that
“strLast†that prints direct from VB on report.

Lots of thanks for giving your time and read my question
 
S

Stephen Lebans

I realize english is not your native language but I can almost understand
what you are trying to accomplish. Could you take a minute repost and
explain in detail exactly what you are trying to accomplish. Forget about
your code for now and focus on what the results are you are looking for.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
J

Jemsson

Hello

I get Sample of Leban that show diffrent setting for the text on Report
Such as "Lastname, Firstname"
Well, I have module that will make few raw of post "strLast" when the text
be more than 18.

Which mean as this post example:

strLast = "Inställningarna bör matcha de inställningar som
nätverksadministratören eller Internet-leverantören angett."

So the module will change the form of text and make raw inside it.
And raw will not be so long raw as this:

strLast = "Inställningarna bör & VbCr & matcha de inställningar som & VbCr &
nätverksadministratören & VbCr & eller Internet-leverantören & VbCr & angett."

Now the result after module looks as this:

strLast = "Inställningarna bör
matcha de inställningar som
nätverksadministratören
eller Internet-leverantören
angett."

And after this text will follow [Firstname] with diffrent option As Leban
sample.

Well, now when I print strLast, so Detail didn't understand How much Hieght
needs to make space for [strLast] post. Because Detail know just TextBox
hieght.

And my question is: I nead calculate how many raw (VbCr) is on "strLast" and
then make empty TextBox and give it Hieght to let Detail understand that on
courrent post which needs more Hieght space.

And my example code, do the hieght, but not on corrent post. Result view on
next post.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim Number, Words, TheRaw As Integer

TheRaw = 0
Number = Len(strLast) ‘strLast data coms from VB print

For Words = 1 To Number Step 1
If Left(Mid(strLast, Words), 1) = vbCr Then
TheRaw = TheRaw + 1
End If
Next Words

If Not TheRaw = 0 Then
Me.txtGrow.Height = 500 * TheRaw
End If
End Sub

Do you have any ide how fix it ?

Lots of thanks for reading my question.
 
S

Stephen Lebans

You are using a translation tool that is causing comprehension problems on
my side. I simply do not understand exactly what you are trying to do.

I think you are using code on my site to ouput text with mixed formatting.
Further you want to shrink the Text if there is too much to fit on one line?
FInally, you are using an Unbound TextBox that you will with CrLf's to set
the size of the Detail section?

To determine the height of the TextBox containing your modified string see:
http://www.lebans.com/textwidth-height.htm
TextHeightWidth.zip is a replacement for the Report object's TextWidth and
TextHeight methods. It is multiline aware and can work in both Report and
Form views. Includes a sample report to show you how to autosize individual
controls with different formatting on the same line to simulate RTF style
text.



History

Version 4.5: Increased accuracy of auto sizing for a ListBox.

Version 4.3: Added sample Form to demonstrate auto sizing for a ListBox.

Version 4.2: Added report to demonstrate auto sizing to mix text formatting
on one row.

Version 4.1: First Release that works!!!<grin>

Version 1.0: First Release
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.



Jemsson said:
Hello

I get Sample of Leban that show diffrent setting for the text on Report
Such as "Lastname, Firstname"
Well, I have module that will make few raw of post "strLast" when the text
be more than 18.

Which mean as this post example:

strLast = "Inställningarna bör matcha de inställningar som
nätverksadministratören eller Internet-leverantören angett."

So the module will change the form of text and make raw inside it.
And raw will not be so long raw as this:

strLast = "Inställningarna bör & VbCr & matcha de inställningar som & VbCr
&
nätverksadministratören & VbCr & eller Internet-leverantören & VbCr &
angett."

Now the result after module looks as this:

strLast = "Inställningarna bör
matcha de inställningar som
nätverksadministratören
eller Internet-leverantören
angett."

And after this text will follow [Firstname] with diffrent option As Leban
sample.

Well, now when I print strLast, so Detail didn't understand How much
Hieght
needs to make space for [strLast] post. Because Detail know just TextBox
hieght.

And my question is: I nead calculate how many raw (VbCr) is on "strLast"
and
then make empty TextBox and give it Hieght to let Detail understand that
on
courrent post which needs more Hieght space.

And my example code, do the hieght, but not on corrent post. Result view
on
next post.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim Number, Words, TheRaw As Integer

TheRaw = 0
Number = Len(strLast) 'strLast data coms from VB print

For Words = 1 To Number Step 1
If Left(Mid(strLast, Words), 1) = vbCr Then
TheRaw = TheRaw + 1
End If
Next Words

If Not TheRaw = 0 Then
Me.txtGrow.Height = 500 * TheRaw
End If
End Sub

Do you have any ide how fix it ?

Lots of thanks for reading my question.
 
J

Jemsson

Hello Mr Leban

Thank you for your replay and the sample.

I liked to used this report sample : rptMixFormatting
But it didn’t work when a field have more than 1 raw. It pop message that
says:
Run-time error ‘2100’:
The control or subform control is too lage for this location.

Any way, I am sorry that I didn’t found answer for my question on this
sample you sent, because it is almost useful for who need auto width. But
auto Height on report can man do by field option CAN GROW.
And when I put inside Field and make textcolor Whight so it be over the text
that prints and then be not easy to read text. And there is not option to
make the text inside field Transparent.

My question is very clear.

You can image as this example:

FirstName: “-de, -are†‘ Italik & Blue

strLast = “11111111111 ‘ Blod
22222222222
33333333333
44444444444â€

Result prints on report looks like this:
--------------------------------------
11111111111
22222222222
33333333333
44444444444 -de, -are
--------------------------------------
11111111111
22222222222 –an, -ar
--------------------------------------
11111111111 -a, -ler
--------------------------------------

Now you saw how it should looks on report, but cause I print this text, so
detail not give enough height space. And this is my question.

To loosen this problem, I wrote code that calculate how many VbCr is on
strLast and give height to TextBox that is empty to let Detail understand
that needs more Height space. Depending on strLast for every post how much
needs.

You can try this code with Leban sample “LastName, FirstNameâ€, but Lastname
should have more than 1 raw such as 2 raw or 3 raw.
This code it work, but it not be Auto and this is problem


--------------------
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim Number, Words, TheRaw As Integer

TheRaw = 0
Number = Len(strLast) ‘strLast data coms from VB print

For Words = 1 To Number Step 1
If Left(Mid(strLast, Words), 1) = vbCr Then
TheRaw = TheRaw + 1
End If
Next Words

If Not TheRaw = 0 Then
Me.txtGrow.Height = 500 * TheRaw
End If
End Sub
 
J

Jemsson

Hello Leban

Now it work the detail hieght on the report.

I would like to thank you very much for your time.

Jesus Bless
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top