473,324 Members | 2,178 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Report

Hello! I'm trying to create a report, in which all of the textbox
controls in Detail section I'd like to resize to one size.

Here is a code (Access 2000):

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim c As Control
Dim MaxH As Long
On Error GoTo 999

MaxH = MaxHeight(Me.Section(acDetail))
SetControlsHeight Me.Section(acDetail), MaxH

999:
Err.Clear
End Sub
'-----
Public Function MaxHeight(sec As Section) As Long
Dim c As Control
Dim MaxH As Long
On Error Resume Next

For Each c In sec.Controls
If c.Visible = True Then _
If MaxH < c.Height Then MaxH = c.Height
Next c
MaxHeight = MaxH

End Function
'-----
Public Sub SetControlsHeight(sec As Section, H As Long)
Dim c As Control
On Error Resume Next

For Each c In sec.Controls
If c.Visible = True Then
c.Height = H
End If
Next c

End Sub

As a result I get a row, containing textbox controls with variable
heights.
What's wrong with my code?

Thanks!

Mar 1 '06 #1
4 2820
Igor wrote:
As a result I get a row, containing textbox controls with variable
heights.
What's wrong with my code?


I didn't look closely at your code, but disn't catch anything jumping
out at me on a quick scan (that's not to say it's 100%, mind you).
However, if you have the cangrow and/or canshrink properties of your
text boxes in the report set to yes, this could affect the sizes that
are being printed. I would think with the code that you have I'd want
to make sure these properties are set to NO in report design view. If
you haven't, try that and see if it helps...

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Mar 1 '06 #2
I'm not quite sure where is the most appropriate place to put the code
that you have in the Detail_Print event, but I know it won't work
there. You can't resize controls in the detail print event. You
should be able to put this code in the detail format event, or better
still in the report open event if you don't want it to run every time a
record is formatted for printing.

HTH,
Bruce

Mar 1 '06 #3
It doesn't work neither in the Detail_Print event, nor in then
Detail_Format event.
I can move controls (Me.TextBox.Top=277), but can't resize.
Why I can't change the height?
One of the controls can grow (CanGrow is set to Yes) and the heights of
each rows can be different.
So it doesn't better to put the code into the Report_Open event.
Really it is impossible to resize controls?

Thanks!
Igor Tsoy

Mar 2 '06 #4
You can resize, but it appears that the CanGrow and CanShrink
properties of the controls will override whatever you do to resize the
controls. What specifically are you trying to do? There may be a
combination of settings of CanGrow and CanShrink on the controls and
the section that they are printing in that will do what you want.
Other than that the only option I could think of would be to set
CanGrow and CanShrink both to No and then rewrite your MaxHeight
function using the TextWidth and TextHeight functions to determine what
the actual height of your controls should be at run time.

Bruce

Mar 3 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: CSDunn | last post by:
Hello, I have a situation with MS Access 2000 in which I need to display report data in spreadsheet orientation (much like a datasheet view for a form). If you think of the report in terms of what...
1
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to...
6
by: Bob Alston | last post by:
I am looking for Access reporting add-in that would be easy to use by end users. My key focus is on selection criteria. I am very happy with the Access report writer capabilities. As far as...
1
by: lorirobn | last post by:
Hi, I have a report that works just fine. Now I would like to add the capability to choose selection criteria to limit what is displayed. I created several reports that do this, but they used...
1
by: monskie | last post by:
Hello to all, I have a problem which could be trivial to you guys. This concerns opening several crystal reports on the a crystal viewer on an ASPX page by calling window.open. My...
6
by: Dave | last post by:
On my form I have combo boxes. These combo boxes, after updating them, populate respective listboxes that are located below the combo boxes on the same form. I am trying to use a "generate...
3
by: creative1 | last post by:
Here is how you create a complex data report that involves parent and child commands and you can update information at runtime. Its pretty straight forward to work with simple queries; however,...
12
by: Studiotyphoon | last post by:
Hi, I have report which I need to print 3 times, but would like to have the following headings Customer Copy - Print 1 Accounts Copy - Print 2 File Copy -Print 3 I created a macro to...
11
by: Gord | last post by:
When I open a certain report, it runs some code that generates the records that will be displayed in that report. This works fine. When I go to print preview the report it appears that the code...
0
by: akmaRudiliyn | last post by:
Hi..i am newbie and student in programming,so need help from expert. Here is what i want to do. 1-I want to create Report System/Reporting System. 2-User must choose database and enter username...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.