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.
7 5058
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.
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": - Option Compare Database
-
-
Option Explicit
-
-
Dim FirstPass As Integer
-
-
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
-
On Local Error GoTo Detail_Format_Err
-
If Not FirstPass Then
-
Me!txt_Item_Desc = Me![Item Desc] & " " & "SN: " & Me![SerNbr]
-
FirstPass = True
-
Else
-
Me!txt_Item_Desc = Me!txt_Item_Desc & "," & Me![SerNbr]
-
End If
-
Detail_Format_End:
-
Exit Sub
-
Detail_Format_Err:
-
MsgBox Error$
-
Resume Detail_Format_End
-
End Sub
-
-
Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
-
Me!txt_Item_Desc = Null
-
FirstPass = False
-
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.
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 -
Private Sub Report_Page()
-
-
Dim intLineCount As Integer
-
Dim intLines As Integer
-
Dim intLineSpacing As Integer
-
Dim intTopMargin As Integer
-
Dim intYPos As Integer
-
-
intLines = 10
-
intTopMargin = 8640 '720 twips per half inch X 12 = 6 inch top margin
-
intLineSpacing = Me.Detail.Height
-
-
If Me.Page = Me.Pages Then
-
For intLineCount = 1 To intLines
-
intYPos = (intLineCount * intLineSpacing) + _
-
intTopMargin
-
Me.Line (0, intYPos)- _
-
Step(Me.Width, 0)
-
Next
-
End If
-
End Sub
-
Thanks I'll try them out as soon as I get a chance and post the results.
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?
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 Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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
|
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...
|
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...
|
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,...
|
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......
|
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...
|
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...
|
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},...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
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...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
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...
|
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)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
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
| |