A family of Microsoft relational database management systems designed for ease of use.
Alright, I found the solution.
The following worked.
Me.Controls("TextBox") = "Line 1" & vbCrLf & "Line 2"
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi.
I'm trying to programmatically add a New Line in a text box in my form in MS Access 2016.
I have set the Enter Key Behaviour of my TextBox to "New Line in Field".
My code is in the Form_Load sub and everything I try simply does not create a new line.
Sample of code I've tried (where TextBox is the name of my text box control):
Me.TextBox = "Line 1" & Chr(13) & Chr(10) & "Line 2" '<<< Doesn't work...
Me.TextBox = "Line 1" & vbCrLf & "Line 2" '<<< Doesn't work...
Me.TextBox = "Line 1" & vbNewLine & "Line 2" '<<< Doesn't work...
I've also tried updating the text property different ways, such as...
TextBox.SetFocus: TextBox.Text = "Line 1" & vbNewLine & "Line 2" '<<< Doesn't work...
TextBox.SetFocus: TextBox.Value = "Line 1" & vbNewLine & "Line 2" '<<< Doesn't work...
Any help would be greatly appreciated!
Thanks,
chamchar
A family of Microsoft relational database management systems designed for ease of use.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Answer accepted by question author
Alright, I found the solution.
The following worked.
Me.Controls("TextBox") = "Line 1" & vbCrLf & "Line 2"