combine fields with return (1 Viewer)

kitty77

Registered User.
Local time
Today, 03:39
Joined
May 27, 2019
Messages
693
I would like to combine four fields (path, password, username, name) into a unbound text box.
But I would like them to be stacked. So, need a return after each field. I tried Chr(10)

Should look like this...

path
password
username
name
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 00:39
Joined
Aug 30, 2003
Messages
36,118
All kinds of ways. For simple display in a textbox you missed Chr(13):

=[path] & Chr(13) & Chr(10) & [password]
 

kitty77

Registered User.
Local time
Today, 03:39
Joined
May 27, 2019
Messages
693
Ahhh. Thanks!!
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 00:39
Joined
Aug 30, 2003
Messages
36,118
Happy to help! Post back if you need something different.
 

kitty77

Registered User.
Local time
Today, 03:39
Joined
May 27, 2019
Messages
693
How do I break this line into two lines. I tried _ with shift enter but I get an error.

="Username: " & [Username] & Chr(13) & Chr(10) & "Password: " & [password]
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 00:39
Joined
Aug 30, 2003
Messages
36,118
That would only work in VBA, I don't think you can in a control source.
 

kitty77

Registered User.
Local time
Today, 03:39
Joined
May 27, 2019
Messages
693
I see. I will try another way then. Thanks.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 00:39
Joined
Aug 30, 2003
Messages
36,118
In VBA it would look like:

Code:
  Me.txtInfo = "Username: " & [UserName] & vbCrLf _
    & "Password: " & [Password]
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 00:39
Joined
Aug 30, 2003
Messages
36,118
Great! I tested in the form's current event. If you need it to update when the source values change, I'd make a little function and call it from the current event plus the after update event of the relevant control(s).
 

kitty77

Registered User.
Local time
Today, 03:39
Joined
May 27, 2019
Messages
693
I actually put it in a command button onclick. Works just as I need. Thanks again...
 

Users who are viewing this thread

Top Bottom