Results 1 to 3 of 3

Thread: print field memo in lines

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Location
    Sao Paulo - SP - BRAZIL
    Posts
    65

    Post

    Hi

    I have a field memo in a table of ACCESS and do I need to print this field in lines of at the most 67 characters, As I make this without breaking words?, does some ready function Exist?

    ------------------
    The blessing of God enriches and it doesn't increase pains

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,175

    Post

    If you have VB6 you can do the following. If you have VB5 then you'll need to use InStr and modify the routine to go forward through the string rather than backward as I have done.
    Code:
        Dim sMyString As String
        Dim nPos As Integer
        Dim nStartPos As Integer
        Dim bDone As Boolean
    
        sMyString = MySnapshot!MyField
        nStartPos = Len(sMyString) - 1
        nPos = nStartPos
        
        Do Until bDone
            If Len(sMyString) <= 67 Then
                Debug.Print sMyString
                bDone = True
                Exit Do
            End If
            Do Until nPos <= 67
                nPos = InStrRev(sMyString, " ", nStartPos)
                nStartPos = nStartPos - 1
            Loop
            Debug.Print Left(sMyString, nPos - 1)
            sMyString = Right(sMyString, Len(sMyString) - (nPos)) 'ok
            nStartPos = Len(sMyString) - 1
            nPos = nStartPos
        Loop
    ------------------
    Marty

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Location
    Sao Paulo - SP - BRAZIL
    Posts
    65

    Post

    What is InStrRev ?

    ------------------
    The blessing of God enriches and it doesn't increase pains

Posting Permissions

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



Click Here to Expand Forum to Full Width