Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

use vba to press enter key 1

Status
Not open for further replies.

autex

Technical User
Jan 11, 2005
75
US
I have a form that displays personal info. User presses a button that brings up a pop up form that shows certain info: name, address etc. so that the user may copy and paste this information in a usable form somewhere else. Right now I'm using an unbound form with a big textbox in it. Unless you can suggest a better way to do this, what code do I use to get the cursor to start a new line in the textbox?

Get this:
My Name
My address
My city, st, zip

instead of this:
My name My address my city, st, zip
 
i dont know how you get the info in to the unbound txbox but change in to my name & vbcrlf & myaddress & vbcrlf & ....
 
oh I got ya thanks, that's not my variables just how I want the display to work. I've been playing with this and this is the best I got. Please let me know if I'm being silly

Me.Text0.SetFocus
SendKeys name & "{enter}" & company & "{enter}" & company1 & "{enter}" & company2 & "{enter}" & city & "{enter}" & state & "{enter}" & zip
 
What about this ?
Me.Text0.SetFocus
Me.Text0 = name & vbCrLf & company & vbCrLf & company1 & vbCrLf & company2 & vbCrLf & city & vbCrLf & state & vbCrLf & zip

You may have to play with vbLf or vbCr instead of vbCrLf.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
with pvh's method you dont need Me.Text0.SetFocus
 
Oh sorry pwise I didn't realize you were introducing vbcrlf I hadn't seen that before. Thanks both of you. I'll play with this.
 
You can also use the ascii code for the carriage return in your text box:

Me.Text0 = name & Chr(13) & company & chr(13) & company1 & Chr(13) & company2 & Chr(13) & city & Chr(13) & state & Chr(13) & zip
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top