UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> combine several fields in one text box    
 
   
lisa2004
post Jan 18 2005, 10:32 AM
Post #1

UtterAccess Veteran
Posts: 480



I have 3 fields, field1="Hello,", field2="How are you?", field3="My name is Lisa."
If I want 3 fields show on 1 text box control MyTextBox, I set MyTextBox recordsource
=field1 & " " & field2 " " & field3

It will show as:
Hello, How are you? My name is Lisa.

How to let it show as (with line change \n, what is the syntax here for \n)
Hello,
How are you?
My name is Lisa.

The reason for this is actually for a report.
=Trim(IIf(rootCause1=False," ",rootWhy1 & "\n " ) & IIf(rootCause2=False," ",rootWhy2 & "\n ") & IIf(rootCause3=False," ",rootWhy3 & "\n ") & IIf(rootCause4=False," ",rootWhy4 & "\n ") & IIf(rootCause5=False," ",rootWhy5))

Thanks in advance.

Lisa
Go to the top of the page
 
+
Mink
post Jan 18 2005, 10:35 AM
Post #2

UtterAccess Veteran
Posts: 430



The code for a carriage return is & vbCr and should work as =field1 & vbCr & field2 & vbCr & field3

HTH
Mink
Go to the top of the page
 
+
lisa2004
post Jan 18 2005, 10:52 AM
Post #3

UtterAccess Veteran
Posts: 480



I tested, seems not work.

code:
Private Sub Form_Current()
Me!test = [rootWhy1] & vbCr & [rootWhy2]
Me!test2 = "Test1" & vbCr & "Test2"
end sub

result:(field rootWhy1="why1", rootWhy2 ="why2")
test = why1why2
test2=Test1Test2
Go to the top of the page
 
+
Mink
post Jan 18 2005, 10:54 AM
Post #4

UtterAccess Veteran
Posts: 430



I am not so good at syntax, but I use the command in a email string that I got off these forums.

"ECR " & Me.ECRNumber & " has been entered by " & Me.Text29 & " and is waiting to be reviewed." & vbCr & " " & vbCr & "Click on the Link below to access the database." & vbCr & " " & vbCr & GetFullPath()

Returns

"ECR 0001 has been entered by Name and is waiting to be reviewed.

Click on the link below to access the database.

(path to database)"
Go to the top of the page
 
+
ScottGem
post Jan 18 2005, 11:02 AM
Post #5

UtterAccess VIP / UA Clown
Posts: 25,212
From: LI, NY



Try vbCrLf
Go to the top of the page
 
+
lisa2004
post Jan 18 2005, 11:16 AM
Post #6

UtterAccess Veteran
Posts: 480



Cool, great, it worked on form code (but not under control box property)
The same reason I guess, when I applied it to my report text control recordsource


=Trim(IIf(rootCause1=False," ",rootWhy1 & vbCrLf) & IIf(rootCause2=False," ",rootWhy2 & "vbCrLf) & IIf(rootCause3=False," ",rootWhy3 & "\n ") & IIf(rootCause4=False," ",rootWhy4 & "\n ") & IIf(rootCause5=False," ",rootWhy5))

Report doesn't recognize vbCrLf. The thing is if I try to applied it to code, I have to change text box recordsource under report design mode, which may cause security permission problem.

The way I can think is to creat a form as subreport. I am not sure is there a better way?

Lisa
Go to the top of the page
 
+
Larry Larsen
post Jan 18 2005, 11:20 AM
Post #7

UA Editor + Utterly Certified
Posts: 22,726
From: Melton Mowbray,Leicestershire (U.K)



Hi Lisa
+Chr(13)+Chr(10) work in reports..
(IMG:http://www.utteraccess.com/forum/style_emoticons/default/thumbup.gif)
Go to the top of the page
 
+
lisa2004
post Jan 18 2005, 11:28 AM
Post #8

UtterAccess Veteran
Posts: 480



Great!!! This is a so cool place to share the ideas. Thanks for all of your response.


Lisa
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 19th June 2013 - 06:22 PM