Solved

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

Posted on 2011-09-22
7
298 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 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

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

Industry Leaders: 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!

Question has a verified solution.

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

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

738 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