Detail

J

Jemsson

Hello

I have report with two columns

I have code on Detail Event that make print on the detail insted textbox.

And when I am going to print ex. 3 raw, so I need to change Detail.Height

such as this example:


Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

Dim Number As Intiger
Dim info As String
Number = Me.Detail.Height

info = "-------" & VbCr & "--------" & VbCr & "----" & VbCr & "------"

how many & VbCr & = info ' it shuld give 3

Me.Detail.Height = 0,598cm * 3

' here I have already all the code to print the text

Me.Detail.Height = Number

End Sub


But the problem when I try to change the Detail Height I get this message:
Run-time error '2191':
You can't set the Height property in
print preview or printing has started.

How can I change Detail Height, because evry post have diffrent number of
raw ?


Thanks
 
M

Marshall Barton

Jemsson said:
I have report with two columns

I have code on Detail Event that make print on the detail insted textbox.

And when I am going to print ex. 3 raw, so I need to change Detail.Height

such as this example:


Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

Dim Number As Intiger
Dim info As String
Number = Me.Detail.Height

info = "-------" & VbCr & "--------" & VbCr & "----" & VbCr & "------"

how many & VbCr & = info ' it shuld give 3

Me.Detail.Height = 0,598cm * 3

' here I have already all the code to print the text

Me.Detail.Height = Number

End Sub


But the problem when I try to change the Detail Height I get this message:
Run-time error '2191':
You can't set the Height property in
print preview or printing has started.


That message means what it says.

Fortunately, you do not need to change the detail section's
Height. Just set the text box and the detail section's
CanGrow prooerty to Yes and the sizes will be adjusted
automatically.
 
J

Jemsson

Hello

Thank you for replay.
Yes, I know if I use Text Box and CAN GROW it work correct, but I am
printing by code in VB and when I test it, so it show not correct hight.

It looks that Detail hight not know on when man print from VB.
Do you think it is impossible to fix such code ?

Thanks
 
M

Marshall Barton

Jemsson said:
Yes, I know if I use Text Box and CAN GROW it work correct, but I am
printing by code in VB and when I test it, so it show not correct hight.

It looks that Detail hight not know on when man print from VB.
Do you think it is impossible to fix such code ?


Why can't you use the CanGrow text box? You can certainly
set the text box's value to your concatenated string in VBA.

In AXP or later, you can change the detail section's Height
so I assume you are using A2K or earlier.

If you're using the Print method, then no, the report is not
aware of your need for more space.

If none of that helps, then I'll need more info before even
trying to see what might do what you want.
 
J

Jemsson

Hello
Why can't you use the CanGrow text box?

Because I have text that is blod then it be changed
to normal and Italik. And as you know the text box
can't make more than only one option on it. And that's
why I use code on Detail Event to read Field and
make option and then print it.

By the way, I try to make text Box that contain same data
and make it as white color to not views. But the problem
is the Text Box shows over the VB print code.
set the text box's value to your concatenated string in VBA.

What is the code for this ?
So I will try it and see.
In AXP or later, you can change the detail section's Height
so I assume you are using A2K or earlier.

Yes, but I need it to be auto, because not all
post have many raw.

If you're using the Print method, then no, the report is not
aware of your need for more space.

yeah, and this is the problem

the post contain dictionary filed such as ex.

blod text HELLO then Normal & Italik text you
so samtime HELLO will be more than one word
and it be problem cause hight be not enough

Well, This code I use to print is by Leban
But I changed it to make it with many raw

Thanks
 
J

Jemsson

Hello


Thanks for replay. I try to understand that you wrote. I think you meand as
the foloing that I tested:


I made two empty text Box:
name: txtGrow (setting Can GROW)
name: txtShrink (Setting CAN SHRINK)

and on Detail choosed CAN SRINK

and on Detail Event wrote as folloing:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
..Height
End Sub

But I get wrong with .Height
And above din't give any effect.

I know that I didn't understand exact, if it is possible to write the code
that I just paste it on Detail.

Stephen's RTF control instead
It pop message such as there is missing.
Maybe cause using XP.


Lots of thanks for your time
 
J

Jemsson

Hi agin

What is your opinion about this ide I am thinking about it:

Make empty Feild with name: aa

Put on Detail event such as this code:
------------------
Dim Number As Intiger

' Number calculate how many raw " VbCr" and give number
Number = "hello you & VbCr & how are you & VbCr & geat"

Me.aa = VbCr * Number
 
M

Marshall Barton

Jemsson said:
Thanks for replay. I try to understand that you wrote. I think you meand as
the foloing that I tested:

I made two empty text Box:
name: txtGrow (setting Can GROW)
name: txtShrink (Setting CAN SHRINK)

and on Detail choosed CAN SRINK

and on Detail Event wrote as folloing:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
.Height
End Sub

You have to have some method of determining how tall you
need the detail section to be so that it can display your
text. Earlier, you said you wanted to do something like:
info = "-------" & VbCr & "--------" & VbCr & "----" &
VbCr & "------"
how many & VbCr & = info ' it shuld give 3
Me.Detail.Height = 0,598cm * 3

What I am saying now is that you can get that effect by
using:
info = "-------" & vbCrLf & "--------" & vbCrLf & "----" &
vbCrLf & "------"
Number = Len(info) - _
Len(Replace(info, vbCrLf ,"")/Len(vbCrLF) + 1
Me.txtGrow.Height = 0,598cm * Number

BUT, how do you know that none of the lines between newlines
wiil fit in the report width? If any line wraps to the next
line, then there will be a newline that you didn't count.
If you have considered this problem and will not run into
this issue, then I think you should be be able to do what
you want.

I know that I didn't understand exact, if it is possible to write the code
that I just paste it on Detail.

No, I can't write the code. You have not explained it
clearly enough for that. Besides, It's your project, we can
help you, but it's unreasonable to ask us to do the work
too.

It pop message such as there is missing.
Maybe cause using XP.

I doubt that. You probably have not understood how to set
it up and use it correctly.
 
M

Marshall Barton

Jemsson said:
Hi agin

What is your opinion about this ide I am thinking about it:

Make empty Feild with name: aa

Put on Detail event such as this code:
------------------
Dim Number As Intiger

' Number calculate how many raw " VbCr" and give number
Number = "hello you & VbCr & how are you & VbCr & geat"

Me.aa = VbCr * Number

That's more or less what I have been saying. See my
previous reply for details.
 

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