Solved

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

Posted on 2011-09-22
7
260 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:PBLack
Comment Utility
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
Comment Utility
full marks for attempt
0
 
LVL 7

Expert Comment

by:shaydie
Comment Utility
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
Comment Utility
thanks shaydie

much appreciated
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
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…

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now