473,385 Members | 2,210 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,385 software developers and data experts.

Increase line length if a field on a report grows

I have created a report that looks like a spreadsheet. The only problem is that when one of the cell grows (cangrow property is yes) then the lines beside them are not long enough. I tried this code in the on format event of the form detail section

Expand|Select|Wrap|Line Numbers
  1. Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
  2.  
  3. Me.Line96.Height = Me.description.Height
  4. Me.Line95.Height = Me.description.Height
  5. Me.Line94.Height = Me.description.Height
  6. Me.Line93.Height = Me.description.Height
  7. Me.Line92.Height = Me.description.Height
  8. Me.Line91.Height = Me.description.Height
  9. Me.Line90.Height = Me.description.Height
  10. Me.Line109.Height = Me.description.Height
  11.  
  12. End Sub
  13.  
But nothing changed. There will be multiple rows printing out on this report. Is there anyway to see how much the cell grows, or (through code) if the cell is going to grow, and if yes by how much. Then I could just set the height of the lines first.....maybe.

I have only made the one field (description) able to grow, and the field walls are transparent so that the height will only be decided by the sigle field.

Any help will be greatly appreciated.
Mar 3 '09 #1
3 4565
ADezii
8,834 Expert 8TB
@kstevens
The following code will dynamically create a Vertical Line of any Width you so desire, which will be of the same Height of a Control on a Report whose CanGrow and CanShrink Properties are set to Yes. The code must reside in the Print Event of either the Detail Section or a Footer Section. In this demo, I generated a Vertical Line directly to the Left of a Description Control within a Report's Detail Section. The Line will dynamically grow to accommodate varying Heights of the Description Control. In this case, a Picture is worth 1,000 words, so download the Attachment and see what is going on. If you have any questions, please feel free to ask.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
  2. Dim sngLineTop As Single
  3. Dim sngLineLeft As Single
  4. Dim sngLineWidth As Single
  5. Dim sngLineHeight As Single
  6.  
  7. Const conTWIPS = 1
  8. Const conSOLID = 0
  9.  
  10. Me.ScaleMode = conTWIPS
  11. Me.DrawStyle = conSOLID
  12.  
  13. 'Set the Line coordinates
  14. sngLineTop = Me![Description].Top
  15. sngLineLeft = (Me![Description].Left - 50)
  16. sngLineWidth = 25   'Width of Line
  17.  
  18. With Me![Description]
  19.   sngLineHeight = .Height
  20. End With
  21.  
  22. 'Now, draw the Line with the Box Fill Option
  23. Me.Line (sngLineLeft, sngLineTop)-Step(sngLineWidth, sngLineHeight), , BF
  24. End Sub
Mar 4 '09 #2
Thanks ADezzi,

I modified the code like this
Expand|Select|Wrap|Line Numbers
  1. Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
  2.  
  3. Const conTWIPS = 1
  4. Const conSOLID = 0
  5.  
  6. Me.ScaleMode = conTWIPS
  7. Me.DrawStyle = conSOLID
  8.  
  9. Me.Line ((Me![LineItem].Left - 10), Me![LineItem].Top)-Step(3, Me![description].Height), , BF
  10. Me.Line ((Me![LineQty].Left - 10), Me![LineQty].Top)-Step(3, Me![description].Height), , BF
  11. Me.Line ((Me![Text111].Left - 10), Me![Text111].Top)-Step(3, Me![description].Height), , BF
  12. Me.Line ((Me![description].Left - 10), Me![description].Top)-Step(3, Me![description].Height), , BF
  13. Me.Line ((Me![SerialNum].Left - 10), Me![SerialNum].Top)-Step(3, Me![description].Height), , BF
  14. Me.Line ((Me![WorkOrderNumber].Left - 10), Me![WorkOrderNumber].Top)-Step(3, Me![description].Height), , BF
  15. Me.Line ((Me![InvoiceNo].Left - 10), Me![InvoiceNo].Top)-Step(3, Me![description].Height), , BF
  16. Me.Line ((Me![temp].Left - 10), Me![temp].Top)-Step(3, Me![description].Height), , BF
  17. End Sub
  18.  
And it worked great. Thanks for the reply...... Do you really just sit around and wirte experimental databases just to upload...., crazy if you do, but it is very much appreciated.
Mar 4 '09 #3
ADezii
8,834 Expert 8TB
@kstevens
Glad it worked out for you.
Mar 5 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Tony Clarke | last post by:
Hi, Background: I have written a Call Logging and Reporting System using PHP that integrates with an existing MS Access Database. The information in the database is all held in flat tables...
7
by: jamait | last post by:
Hi all, I m trying to read in a text file into a datatable... Not sure on how to split up the information though, regex or substrings...? sample: Col1 Col2 ...
6
by: Darren Dale | last post by:
Is there a module somewhere that intelligently deals with reports to the command line? I would like to report the progress of some pretty lengthy simulations, and currently I have the new reports...
3
by: gary | last post by:
Hi, 1. About all C/C++ compilers, Does stack increase from high address to low address and heap grow increase from low to high? What on earth decides their increase direction, CPU architecture, OS...
4
by: intl04 | last post by:
I have a memo field that is included in some Access reports I created. Is there some way for the memo field to display nicely formatted text, with line breaks between paragraphs? Or is it necessary...
5
by: ChadDiesel | last post by:
My basic question is why does my print report button on my subform print a blank report when my cursor is on a blank entry line? Here is a more detailed explanation of my problem. I have a...
5
by: RThaden | last post by:
Hi all, I have a text file with a list of MAC addresses. Each time, my program is called it reads the last MAC address entry from the file, increases it by one, writes this new address into a 6...
5
by: John | last post by:
Hi I have a typical front end/back end access app. Additionally a vb.net app accesses the backend mdb file every few minutes and runs insert and update queries on some table. The data to be...
10
by: uche | last post by:
Hello all! I have thought about this question for a long time and I would like to know your opinion about it: In C, a variable-length string can be carried in RAM as a sequence of ASCII characters...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.