Results 1 to 3 of 3
  1. #1
    gykiang is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Nov 2013
    Posts
    47

    Adding empty row in field

    My field size is 50 characters.



    Is there any way to write an expression that when the texts reach 25 characters, add Chr(13) & Chr(10), then resume the display of the field texts between 26 to 50 character.

    Width of the field box allows up to 25 characters and no problem to take up to 3 rows by height.

    The intention is to insert an empty line in between the texts.

    Or is there a better way to workaround rather than using the above method ?

    Thanks.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Why is this important? If you use proportional font, the lines will not appear the same length anyway.

    I don't think a simple expression would work, probably need VBA function.

    Could use non-proportional font and size textbox to display 25 characters and let the line wrap. I like Consolas font.
    Last edited by June7; 09-12-2014 at 02:20 PM.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    As June7 suggested, unless you use a monospaced/fixed-width font, such as Courier, Prestige Elite or Monaco, getting this perfect will be a matter of luck. Trying to do this, interactively, involves keeping track of the number of characters entered, which usually ends up being a mare's nest, because of the possibility of the user backing up and inserting characters, moving forward and inserting characters, doing the same but deleting characters, etc. To avoid this I would allow the user to simply enter the data and split the entered text after the fact, as it were:

    Code:
    Private Sub YourTextBox_AfterUpdate()
     If Len(Me.YourTextBox) > 25 Then
      Me.YourTextBox = Left(Me.YourTextBox, 25) & vbNewLine & vbNewLine & Mid(Me.YourTextBox, 26)
     End If
    End Sub

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Saviing a Form with empty field
    By djclntn in forum Forms
    Replies: 7
    Last Post: 11-17-2012, 09:35 PM
  2. Replies: 2
    Last Post: 04-23-2012, 10:13 PM
  3. Replies: 4
    Last Post: 11-20-2011, 01:08 PM
  4. Delete Field if Empty?
    By bpowers2010 in forum Reports
    Replies: 1
    Last Post: 07-10-2010, 12:04 AM
  5. empty field
    By amber mara in forum Access
    Replies: 2
    Last Post: 05-05-2010, 01:46 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
  •  
Other Forums: Microsoft Office Forums