Solved

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

Posted on 2011-09-22
7
295 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
  • 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 500 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
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 Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

685 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