By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,946 Members | 697 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,946 IT Pros & Developers. It's quick & easy.

Line/Carriage Return in MS Access Text Box

P: 4
Hello,

I'm using Access 2002 to create a text box that will contain the following information in this format:

Name
Title
Company
City, State
email

I entered the following expression in a text box:

=[FULL_NAME] & Chr(10) & Chr(13) & [TITLE] & Chr(10) & Chr(13) & [COMPANY] & Chr(10) & Chr(13) & [CITY_STATE] & Chr(10) & Chr(13) & [email]

This is the result of the expression:

Name   Title   Company   City, State   email

I've tried using Chr(10) only and Chr(13) only, but I still cannot get each field to appear on a separate line. Does anyone have any suggestions.

Thanks!
May 18 '07 #1
Share this Question
Share on Google+
4 Replies


P: 3
If you going to be looking through records and want this to show up, you could create an event on Current. You would also have to have the fields actually in the form, but make them not visible.

Private Sub Form_Current()
Form_Form1.Text0.SetFocus
Form_Form1.Text0.Text = ""
If IsNull(Form_Form1.Full_Name) = False Then
Form_Form1.Text0.Text = Form_Form1.Full_Name
End If
If IsNull(Form_Form1.Title) = False Then
Form_Form1.Text0.Text = Form_Form1.Text0.Text & vbNewLine & Form_Form1.Title
End If
If IsNull(Form_Form1.Company) = False Then
Form_Form1.Text0.Text = Form_Form1.Text0.Text & vbNewLine & Form_Form1.Company
End If
If IsNull(Form_Form1.City_State) = False Then
Form_Form1.Text0.Text = Form_Form1.Text0.Text & vbNewLine & Form_Form1.City_State
End If
If IsNull(Form_Form1.Email) = False Then
Form_Form1.Text0.Text = Form_Form1.Text0.Text & vbNewLine & Form_Form1.Email
End If
End Sub
May 18 '07 #2

P: 4
The text box I'm setting up is for an Access report, not in a form. Will the formula below work?




If you going to be looking through records and want this to show up, you could create an event on Current. You would also have to have the fields actually in the form, but make them not visible.

Private Sub Form_Current()
Form_Form1.Text0.SetFocus
Form_Form1.Text0.Text = ""
If IsNull(Form_Form1.Full_Name) = False Then
Form_Form1.Text0.Text = Form_Form1.Full_Name
End If
If IsNull(Form_Form1.Title) = False Then
Form_Form1.Text0.Text = Form_Form1.Text0.Text & vbNewLine & Form_Form1.Title
End If
If IsNull(Form_Form1.Company) = False Then
Form_Form1.Text0.Text = Form_Form1.Text0.Text & vbNewLine & Form_Form1.Company
End If
If IsNull(Form_Form1.City_State) = False Then
Form_Form1.Text0.Text = Form_Form1.Text0.Text & vbNewLine & Form_Form1.City_State
End If
If IsNull(Form_Form1.Email) = False Then
Form_Form1.Text0.Text = Form_Form1.Text0.Text & vbNewLine & Form_Form1.Email
End If
End Sub
May 18 '07 #3

puppydogbuddy
Expert 100+
P: 1,923
I think all you have to do is highlight the textbox control, invoke the property sheet and set the following two properties as shown. It may or may not require a rich text box in order to work:

Enter Key Behavior = New Line in Field
Can Grow = Yes or No (Your choice for the textbox itself)
May 18 '07 #4

P: 1
I just found this, and the code monkeys and I laughed for about ten minutes.

=[Field_1]+ "
" + [Field_2]

Try it. Seriously.

[Ctrl+Enter lets you insert that line break in the code in design view]
Jun 12 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.