Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Memo on 2 lines 1

Status
Not open for further replies.

cjany

IS-IT--Management
Nov 3, 2004
72
US
I have a memo field that I would like to display 5 characters on the 1st line and the remaining characters on the 2nd lines in the query.

Original Memo Field: I ran after the dog.

Desired Memo Field: I ran
after the dog.

Any suggestions?
 
Hi, cjany,

In the Control Source for your textbox:
Code:
= Left([MyMemoField], 5) & Chr(13) & Chr(10) & Mid([MyMemoField], 6)
Or if you want to be a bit more accurate and not have an unnecessary carriage return:
Code:
= IIf(Len([MyMemoField]) > 5, Left([MyMemoField], 5) & Chr(13) & Chr(10) & Mid([MyMemoField], 6), [MyMemoField])
Or if you want to really go all out and make this available anywhere in your DB, put this in a module:
Code:
Public Function FormatMyString(strMyString As String) As String
If Len(strMyString) > 5 Then
    FormatMyString = Trim(Left(strMyString, 5)) & vbCrLf & Trim(Mid(strMyString, 6))
    Else
        FormatMyString = strMyString
End If
End Function
Then in the Control Source of your textbox:
Code:
= FormatMyString([MyMemoField])

HTH,

Ken S.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top