?
Solved

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

Posted on 2011-09-22
7
Medium Priority
?
308 Views
Last Modified: 2012-05-12
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
0
Comment
Question by:PBLack
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 36581398
Try the following VBA in the Open event of your form:

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

0
 

Author Comment

by:PBLack
ID: 36581486
hi

I can not get it to work

it just puts #Name? into the textbox
0
 
LVL 61

Accepted Solution

by:
mbizup earned 2000 total points
ID: 36581508
I'm a little hesitant to say "It can't be done", but even the method of typing Ctrl+Enter for new lines doesn't seem to work.

In the expression bulder, it shows up correctly but it does not display correctly in form view.

Maybe others will have ideas...
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:PBLack
ID: 36581552
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.
0
 

Author Closing Comment

by:PBLack
ID: 36581557
full marks for attempt
0
 
LVL 7

Expert Comment

by:shaydie
ID: 36582613
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"
0
 

Author Comment

by:PBLack
ID: 36584025
thanks shaydie

much appreciated
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question