DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Determining Number of Lines of Data in a Text Box - MS ACCESS

  1. #1
    Join Date
    Jul 2008
    Posts
    2

    Determining Number of Lines of Data in a Text Box - MS ACCESS

    I am designing a report in which I need to determine the number of lines each record produces. I only have to worry about one field, which is the description field. Since I have it set to grow I need to be able to determine how many lines it will produce.

    I'm sure there must be a solution.

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    Welcome to DevX

    Are you storing carriage returns with the text?

    If not, then you will have just one continuous line of text even though it may appear, visually, as multiple lines if you retrieve it from your database and plop it into a textbox.

    Basically speaking, counting the number of lines is synonymous with counting the number of carriage returns.

  3. #3
    Join Date
    Jul 2008
    Posts
    2
    Thank you for your reply.

    I suppose the text could have both forced carriage returns as well as running over to the next line as limited by the width of the text box in the report.

    I do not know how to determine the number of carriage returns, therefore, preventing me from determing the number of lines.

    Perhaps you could start me down the path of determining the number of carriage returns.

    Again, thanks...

  4. #4
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    Quote Originally Posted by hardhat4u
    Perhaps you could start me down the path of determining the number of carriage returns.
    Love to.

    This should get you started
    Code:
    Private Sub Command1_Click()
    Dim arrLines() As String
    Dim intLineCount As Integer
    arrLines = Split(Text1.Text, vbCrLf)    
    intLineCount = UBound(arrLines) + 1
    MsgBox intLineCount
    End Sub

Similar Threads

  1. Replies: 3
    Last Post: 05-10-2008, 06:04 PM
  2. Replies: 1
    Last Post: 04-09-2008, 07:28 AM
  3. Access 97 to 2000 Conversion Error
    By Michelle in forum VB Classic
    Replies: 8
    Last Post: 04-19-2002, 05:01 PM
  4. Data Access Pages to Emulate Website on CD
    By John Simmons in forum Enterprise
    Replies: 0
    Last Post: 02-09-2001, 01:42 PM
  5. Replies: 6
    Last Post: 11-29-2000, 04:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center