Link to home
Start Free TrialLog in
Avatar of Todd MacPherson
Todd MacPhersonFlag for Canada

asked on

Textbox - how do I include line breaks in the default value to a text box

Hi

I have a textbox and its enter key behavior is set to new line. I want to set the default value to have a line break as follows:

1234 Bill
3435 Steve
7788 John

It is going to a memo field in the db. It works fine for user entry into the text box but the client wants a default value as above to save keying in every time. How do I do this? Currently the default value runs together.

Thanks

PBLack
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Try the following VBA in the Open event of your form:

Me.MyTextbox.DefaultValue = "1234 Bill" & vbcrlf  & "3435 Steve" & vbcrlf &  "7788 John"

Avatar of Todd MacPherson

ASKER

hi

I can not get it to work

it just puts #Name? into the textbox
ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Here is what I did. I just put Me.MyTextbox = "1234 Bill" & vbcrlf  & "3435 Steve" & vbcrlf &  "7788 John"

That works and if I am calling from existing data in a table then it overwrites this. Works for me.
full marks for attempt
Avatar of shaydie
shaydie

I see you already have an answer and closed the question.. but just a FYI anyway.. You can use Chr(10) & Chr(13) for a line break in your default value.
"1234 Bill" & Chr(13) & Chr(10) & "3435 Steve" & Chr(13) & Chr(10) & "7788 John"
thanks shaydie

much appreciated