473,698 Members | 2,808 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Split a report text box.

30 New Member
I am creating an Access report that replicates a preprinted grid form by using bordered text boxes. Each detail row on the preprinted form accomodates two lines. However,some of my records consist of several lines. When the print view is generated, the first two lines appear in the text box and the remaining lines appear in a blank white space after the bordered area. I want to split records with more than two lines into multiple bordered text boxes so that the data forms one continuous grid with no white space between. I'm fairly certain the code will have to go in the on format event.

Thank you in advance for your help.
Feb 28 '09 #1
7 5131
puppydogbuddy
1,923 Recognized Expert Top Contributor
see this link: http://support.microsoft.com/kb/299011

The link includes a method and code for concatenating values from multiple controls into fewer controls for display purposes, eliminating white space. See if that will work for you.
Feb 28 '09 #2
scottbouley
30 New Member
Thanks for your reply puppydogbuddy.

That's the opposite direction I want to go. I've already concatenated the many side of the relationship to reduce vertical space. However, some of the records are longer than two lines. I'm trying to reproduce an actual grid-style form by using borders on the textboxes. The actual form allows two lines per cell so I set the height of the textboxes to the height of the actual cell to show two lines. However, if a record contains more than two lines, all text after the second line appears outside of the border resulting in unbordered text and a disjointed grid. What I'm looking for, is a way to split the concatenated text field into as many text boxes as neccessary to keep the grid together. Here's my code for the "On Format Event":


Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2.  
  3. Option Explicit
  4.  
  5. Dim FirstPass As Integer
  6.  
  7. Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
  8.     On Local Error GoTo Detail_Format_Err
  9.     If Not FirstPass Then
  10.         Me!txt_Item_Desc = Me![Item Desc] & " " & "SN: " & Me![SerNbr]
  11.         FirstPass = True
  12.     Else
  13.         Me!txt_Item_Desc = Me!txt_Item_Desc & "," & Me![SerNbr]
  14.     End If
  15. Detail_Format_End:
  16.     Exit Sub
  17. Detail_Format_Err:
  18.     MsgBox Error$
  19.     Resume Detail_Format_End
  20. End Sub
  21.  
  22. Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
  23.     Me!txt_Item_Desc = Null
  24.     FirstPass = False
  25. End Sub
Maybe I'm taking the wrong approach. Is it possible to generate the lines in code? Or maybe split the text in the "On Format" Sub?

I'm still somewhat a Newbie since I don't get to do this alot, so I don't know any other way to approach this. Anyway, thanks again.
Feb 28 '09 #3
puppydogbuddy
1,923 Recognized Expert Top Contributor
Hi Scott,
You can try to adapt the code I wrote (see below) to draw a fixed number of lines per page. You can also try the link, which has a free download mdb entitled "Grid report", which shows how to use vba code to draw grid lines in an ms access report.

http://www.mvps.org/access/resources/downloads.htm#G
Expand|Select|Wrap|Line Numbers
  1. Private Sub Report_Page()
  2.  
  3. Dim intLineCount As Integer
  4. Dim intLines As Integer
  5. Dim intLineSpacing As Integer
  6. Dim intTopMargin As Integer
  7. Dim intYPos As Integer
  8.  
  9. intLines = 10
  10. intTopMargin = 8640                        '720 twips per half inch X 12 =  6 inch top margin
  11. intLineSpacing = Me.Detail.Height
  12.  
  13.         If Me.Page = Me.Pages Then
  14.             For intLineCount = 1 To intLines
  15.                 intYPos = (intLineCount * intLineSpacing) + _
  16.                 intTopMargin
  17.                 Me.Line (0, intYPos)- _
  18.                 Step(Me.Width, 0)
  19.             Next
  20.         End If
  21. End Sub
  22.  
Feb 28 '09 #4
puppydogbuddy
1,923 Recognized Expert Top Contributor
If all else fails, Stephen Leban's solution should work:

http://www.lebans.com/PrintLines.htm
Mar 1 '09 #5
scottbouley
30 New Member
Thanks I'll try them out as soon as I get a chance and post the results.
Mar 1 '09 #6
scottbouley
30 New Member
Both of the options you showed me appear to result in a grid that corresponds to the height of the row. I need a fixed grid where the horizontal lines are always 0.3125 inches apart. I was originally trying to split the rows with more than two lines into multiple rows. Which way do you think would be easier?
Mar 6 '09 #7
puppydogbuddy
1,923 Recognized Expert Top Contributor
Scott,
Just got your last response. This site was having difficulties the past couple of days. You mention only 2 options, which means you probably did not see my post about a third option avalable from Stephen Leban's web site. You should check it out....it is probably your best option.

http://www.lebans.com/PrintLines.htm
Mar 8 '09 #8

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

Similar topics

5
27194
by: Blue Ocean | last post by:
In short, it's not working right for me. In long: The program is designed to read numbers from an accumulator and speak them out loud. Unfortunately, the class that contains the method to read off large numbers is only for integers. My intention is to split a String across the Regex of ".". However, this code does not work: private void doRealValueOf(String text) {
4
6749
by: Jan Burgy | last post by:
Hi everyone, can somebody tell me why (using Python 2.3.2) >>> import re >>> re.compile(r"^$", re.MULTILINE).split("foo\n\nbar\n\nbaz") ? Being used to Perl semantics, I expect
1
17664
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 Create a Dynamic Crosstab Report PRODUCT :Microsoft Access PROD/VER:1.00 1.10 OPER/SYS:WINDOWS
1
6881
by: pemigh | last post by:
I have a report with pages breaking in the middle of text box controls. And it's not just on a line-by-line basis, but sometimes (in a situation that I can no longer recreate) just the bottom portions of a line's letters were showing up at the top of a page. My experiments show that Access will ordinarily break before a text box if the whole thing won't fit, but I haven't been able to find a property that will control this behavior. I...
4
3850
by: Cor | last post by:
Hi Newsgroup, I have given an answer in this newsgroup about a "Replace". There came an answer on that I did not understand, so I have done some tests. I got the idea that someone said, that the split method and the regex.replace method was better than the string.replace method and replace function. I did not believe that.
3
9665
by: Ben | last post by:
Hi I am creating a dynamic function to return a two dimensional array from a delimeted string. The delimited string is like: field1...field2...field3... field1...field2...field3... field1...field2...field3...
1
3636
by: Roy | last post by:
I have a table with two fields. I wish to separate all the data in one field and keep it listed against the information in the other field. The information within the field TicketStatus, I wish to separate is separated with a small box, meaning a tab .There can be up to twenty separate bits of info in the field. I would like to get a table in which the information in the field I am trying to separate (TicketStatus),is individually listed...
4
3606
by: kaplan.gillian | last post by:
Hi everyone, I currently have an Access database that includes quite a few long memo fields. When I create a report of my data, Access does not allow the memo fields to be split with the page breaks. In other words, if my memo field is 3 paragraphs long and there is only space on a report page for 2 paragraphs, rather than putting 2 paragraphs on one page and the last one on the next page, all 3 paragraphs are moved to the next page...
10
16466
by: kkshansid | last post by:
i have to split adress like raj,2d-raja road,delhi-10008. to raj, raja road, delhi-10008. i can do it with split function but its giving error msg Dim x(3) As String x = Split ({std.addr}, ",") formula = x(2) If Isnull({std.a}) or ({std.b})= "" then
0
8674
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8893
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7723
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4366
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3045
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2328
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.