Page 1 of 2 12 LastLast
Results 1 to 15 of 30
  1. #1
    New Lounger
    Join Date
    Jul 2002
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    borders on every line 'inside' a multiline textbox (2k)

    I need to create an online form and report that looks the same as the form that is filled out by hand with pen or pencil. The page has a large grid. The problem is in having lines on the bottom, left and right for every row (borders around every textbox--actually around every single line of a textbox).

    Picture a spreadsheet or better yet a Word table. Every row is a uniform heighth with the gridlines or borders left on. When every record is one row tall that works great. The problem is when a record is 2 or more rows tall. The Access text box expands just like a Word table. There's still a border at the bottom of the second row, but now there's no border or line under the first row. The first row of text has to have it's own exact sized box around it, even though some of the text has wrapped around starting a second row.

    I've been trying to solve it with transparent layers. I built a grid of textboxes with the exact size and border height. Then I put the output fields on top with no borders and a transparent background. It doesn't work because the underlying textboxes with borders get pushed down. For example if row 1 turns out to be 3 lines of text, it should spill into or over the bordered textbox in row 2, but that row 2 textbox gets pushed a half inch down the page so it's below all 3 text lines.

    How can I make that row 2 stay at the same place on the page regards of how the objects above it grow?

    Or I'm open to other solutions.

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: borders on every line 'inside' a multiline textbox (2k)

    Sorry, but I'm not clear on whether you're trying to do this in a form or a report. In a report, you do it by drawing lines on the background of the section and setting the backstyle for the data controls to transparent. You can't do it on a form.
    Charlotte

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    352
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: borders on every line 'inside' a multiline textbox (2k)

    How about scanning in an image of the form and using that in the form picture property and then placing transparent bordeless text boxes on top of it.
    David Grugeon
    Brisbane Australia

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: borders on every line 'inside' a multiline textbox (2k)

    The minute the control gets the focus, the background isn't transparent any more, so the lines would be obscured.
    Charlotte

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: borders on every line 'inside' a multiline textbox (2k)

    David Grugeon's idea of using a background picture might work for a report. As Charlotte mentioned, it won't work for a form. You could make copies of the existing blank paper form, and print the report on top of the copy. (The report itself wouldn't have any borders in that case)

    But perhaps you should re-think this. Is it really necessary to recreate the exact look of the paper form, and is it worth spending a lot of effort on it?

  6. #6
    New Lounger
    Join Date
    Jul 2002
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: borders on every line 'inside' a multiline textbox (2k)

    It's to meet a government requirement. Since they work with a variety of companies, they're particular about wanting to see the exact form they are used to seeing.

    I'd like to have the program self-contained and not rely on feeding a preprinted form into the printer. There are a number of different forms, some are multiple pages long with each page being different--gets too confusing to feed forms.

    I hadn't thought of scanning in the form as a background picture. Seems like cheating or something since I envisioned creating the horizontal and vertical borders with controls or code. Sometimes the easy solution can be the best. I'll have to give it some thought and see how it works with multi-page documents where each page is different.

    Thanks for the ideas so far...
    Paul

  7. #7
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: borders on every line 'inside' a multiline textbox (2k)

    I would suggest you consider one of two possibilities:
    1 - Create an Access Report and set text boxes so they are exactly the same size as the government form, and cannot grow (a property)
    2 - Use OLE Automation to drive Word from the Access database, and lay the form out as a Word template. This is more complex, but lets you do RTF so words can be bolded or underlined.

    Hope this helps.
    Wendell

  8. #8
    New Lounger
    Join Date
    Jul 2002
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: borders on every line 'inside' a multiline textbox (2k)

    Thanks for the suggestions.
    1) When I set the "Can Grow" property to NO, I don't get the second and following lines of text on my report--I only get the first line of each record. The attached file shows how there's a complete textbox (or gridlines) around every row of text. They want the convenience of entering a word-wrapping paragraph several rows long, but when it prints it has to be segmented line-by-line into boxes. A 5 line text record gets parsed into 5 textboxes.

    2) I don't particularly need the bolding and underlining of Word, rather I'm looking for a border on all 4 sides of each row of text, and since this will be distributed on dozens of computers at various locations, I'd like to contain it within Access. ...appreciate the ideas though...

    Paul
    Attached Files Attached Files

  9. #9
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: borders on every line 'inside' a multiline textbox (2k)

    Hi Paul,
    Sorry, I didn't realize that the requirement was that each line on the form be bordered. Even in Word that's a fairly ugly trick, but it seems to me there was a post several months ago trying to do the same thing. I don't think there is any good way in Access to do this other than storing the text in chucks of 80 or less characters as separate records and using a continuous form. I gues you could use the LEN, MID and INSTR functions to break text apart into that kind of thing, but then you would want to restrict the font to a mono-spaced font like Courier. If you want to explore that option, repost and one of our wizards will wave his wand and create some air code.
    Wendell

  10. #10
    New Lounger
    Join Date
    Jul 2002
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: borders on every line 'inside' a multiline textbox (2k)

    Here's the whole picture. The "Event" form has grids on it and was traditionally filled out with pen. When we put it in Access we want to have word wrapping and inserting capabilities. Each record has a time stamp and a comment paragraph. If we capture and store one line at a time out the paragraph, it makes word editing miserable. Wouldn't you hate to get to the end of a 10 line paragraph and realize you left two words out of the first line. You'd have to make room in line 1 by cutting some characters from line 1 and puttin them in line 2, then cut some from line 2 and move them to line 3 and so on... So it seems like we should capture each paragraph as a memo field.


    Next step is what I've been trying to accomplish here--printing it in a report with the classic paperform look of the border around each line. If you can rustle up some code for parsing out strings of 70 characters that would be great. Probably need to separate at a space between words too. If you have any comments or suggestions on the input form that'd be great too.

    Paul

  11. #11
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: borders on every line 'inside' a multiline textbox (2k)

    On your first point, I agree - store your data in a memo field. Otherwise as you note, editing gets to be a ridiculous issue. In point of fact you may want to put all of the comment paragraphs in one memo field, unless you want to have different time stamps. In that case you would want to link many comment paragraphs to one Event.

    To do what I suggested with Access functions is going to involve a fair bit of VBA. First, you are going to need to open a recordset, using either DAO or ADO, and step through all of the paragraphs and decompose them into character strings of 70 characters or less where the breaking character is a space or hyphen. Each of those strings then needs to be written to a temporary table that can be used as the data source for a subreport that pulls in the comments. The LEN function is used to determine the length of a string so you know how much work you have to do. The MID function lets you take a subset of a string and work with it. The INSTR function checks a string to find the first occurrence of a particular character. So you start with a 70 character string, and find the right most space or hyphen, then create the first comment string with the MID function. At the next step, you could either look at the next 70 characters starting with the first character past the space or hyphen, or you could reduce the string you are working with and start the next step at character 1. In any event, you are going to need to maintain several counters, and the process isn't going to terribly fast. At this point, I don't have the time necessary to whip up some code that actually does this, but if someone else wants to take a crack, be my guest. Otherwise it's likely to be Wednesday before I get to it. <font color=blue>(Clicking finger got a little quick here, so message was edited at 19:59 MST)</font color=blue>

    There was a similar sort of request by teachesms in the Word forum where a lengthy thread looked at how to do this in Word. Check <post#=132652>post 132652</post#> and see if the info there gives you any ideas.
    Wendell

  12. #12
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: borders on every line 'inside' a multiline textbox (2k)

    We do something similar to this in some of our reports. We allow the user to enter as much text as he needs, but when it comes time to print the report, we need to break it into separate lines that wrap in a particular area of the report . We use lines drawn on the background of the report itself and unbound controls with transparent backgrounds. The text is broken up in code using a preset maximum line length and logic to test whether each next word will make the line exceed the maximum line length. Populating the controls is done in the OnFormat event of the Detail section. Normally it isn't how you enter the data, it's how you print it out has to meet standards. Anyone who insists that the input form looks like a printed form has far too little imagination and is clinging to what they already know.
    Charlotte

  13. #13
    Bronze Lounger
    Join Date
    Nov 2001
    Location
    Arlington, Virginia, USA
    Posts
    1,394
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: borders on every line 'inside' a multiline textbox (2k)

    This is sample sub that parses text string into smaller strings of specified maximum length and stores them in an array. I have no brilliant suggestions on how to insert these strings in the report, depends on design of report. A temporary table, as suggested, may be solution. Code can be modified accordingly. (For this type of thing I normally create a template in Word, using table with form fields to represent paper form, and populate with a recordset in code using automation. I have no need to enclose each line of text in its own box.)

    Public Sub ParseText(ByVal strText As String, intLen As Integer)
    On Error GoTo Err_Handler

    'strText = text to be parsed
    'intLen = max length in characters for each parsed text string
    'Note: not checking for hyphens, only spaces when parsing text
    Dim strMsg As String
    Dim intCount As Integer
    Dim intStop As Integer
    Dim strNew() As String
    Dim n As Integer

    'Adjust counter - this may depend on normal length of text to be parsed
    intCount = Len(strText) intLen + 10
    ReDim strNew(1 To intCount)

    For n = 1 To intCount
    If Len(strText) = 0 Then
    Exit For
    ElseIf Len(strText) > intLen Then
    'Add one to intLen in case space immediately follows:
    If InStr(strText, " ") > intLen + 1 Then
    'Length of first word in string exceeds specified length:
    strMsg = "The specified string length is too small to parse text. " & _
    "Please try again with longer string length."
    MsgBox strMsg, vbExclamation, "PARSE TEXT ERROR"
    Exit Sub
    End If
    'Add one to intLen in case space immediately follows:
    intStop = InStrRev(Left(strText, intLen + 1), " ")
    If intStop > 0 Then
    'do not include space:
    strNew(n) = RTrim(Left(strText, intStop))
    'trim leading space:
    strText = LTrim(Right(strText, Len(strText) - intStop))
    Else
    strNew(n) = Trim(strText)
    strText = ""
    End If
    Else
    strNew(n) = Trim(strText)
    strText = ""
    End If
    'For test purposes only:
    Debug.Print "Text " & n & ": " & strNew(n)
    Next n

    Exit_Sub:
    Erase strNew
    Exit Sub
    Err_Handler:
    strMsg = "Error No " & Err.Number & ": " & Err.Description
    Beep
    MsgBox strMsg, vbExclamation, "PARSE TEXT ERROR MESSAGE"
    Resume Exit_Sub

    End Sub

    HTH

  14. #14
    New Lounger
    Join Date
    Jul 2002
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: borders on every line 'inside' a multiline textbox (2k)

    Wendell,
    Thanks for the referral to the Word thread. Very informative. Some of the same issues apply here. I'm seeing if I can apply some of it to my situation. It gets more complicated since I have a time stamp to go with each memo field record. If I parse the memo into multiple lines do I store the date with each line... Still thinking it through.
    Thanks so far.
    Paul

  15. #15
    New Lounger
    Join Date
    Jul 2002
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: borders on every line 'inside' a multiline textbox (2k)

    I agree that in most cases it's not how the data is entered or how much is entered but how the finished product looks, i.e. the report. In this case, they get a fixed space: 31 lines about 3/4 of a page. They can't rollover into another page. If it were just one long memo, I could use your line of logic. However it's a two column entry: A time stamp in column 1 and a comment in column 2. There could be one comment 31 lines long, or there may be multiple timestamped entries with each comment being 1 or multiple lines. This business of conforming to a government agencies legacy reporting standards is challenging.
    Paul

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •