Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Reports / Printing / December 2005

Tip: Looking for answers? Try searching our database.

Detail

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jemsson - 21 Dec 2005 21:48 GMT
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
Marshall Barton - 21 Dec 2005 22:53 GMT
>I have report with two columns
>
[quoted text clipped - 26 lines]
>  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.

Signature

Marsh
MVP [MS Access]

Jemsson - 22 Dec 2005 17:43 GMT
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
Marshall Barton - 22 Dec 2005 18:44 GMT
>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.

Signature

Marsh
MVP [MS Access]

Jemsson - 23 Dec 2005 01:42 GMT
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
Marshall Barton - 23 Dec 2005 04:15 GMT
>> Why can't you use the CanGrow text box?
>
[quoted text clipped - 32 lines]
>   Well, This code I use to print is by Leban
>   But I changed it to make it with many raw

I can think of two approaches to get the effect you want.

The most obvious is to use Stephen's RTF control instead of
trying to use .Print

I tested the other idea using A97, and your current
approach.  Use an unbound, blank text box, named txtGrow to
force the detail section's Height to what you need.  In the
detail section's Format event, set the text box's .Height to
the calculated height to make the detail section's height
grow.  You can then use the .Print method to print the text.

Unfortunately, the detail section will not reset it's new
height back to what it was originally for the next record.
To get the section Height to shrink to only the size needed
for the current record's txtGrow text box, add another
unbound, blank text box named txtShrink.  Make this text box
25cm tall and set its CanShrink property to Yes.  Make sure
the detail section's CanShrink property is also set to Yes.

Signature

Marsh
MVP [MS Access]

Jemsson - 23 Dec 2005 19:41 GMT
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
Jemsson - 24 Dec 2005 13:18 GMT
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
-------------------
Do Do you think it is possible like this code ?
If yes, so it be great

Thanks for your help
Marshall Barton - 24 Dec 2005 16:48 GMT
>Hi agin
>
[quoted text clipped - 13 lines]
>Do Do you think it is possible like this code ?
>If yes, so it be great

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

Signature

Marsh
MVP [MS Access]

Marshall Barton - 24 Dec 2005 16:46 GMT
>Thanks for replay. I try to understand that you wrote. I think you meand as
>the foloing that I tested:
[quoted text clipped - 10 lines]
>.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.

>>Stephen's RTF control instead
>  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.

Signature

Marsh
MVP [MS Access]

Jemsson - 25 Dec 2005 06:25 GMT
Hello

Thank you very much for the code

Jesus Bless
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.