lisa2004
Jan 18 2005, 10:32 AM
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
Mink
Jan 18 2005, 10:35 AM
The code for a carriage return is & vbCr and should work as =field1 & vbCr & field2 & vbCr & field3
HTH
Mink
lisa2004
Jan 18 2005, 10:52 AM
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
Mink
Jan 18 2005, 10:54 AM
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)"
ScottGem
Jan 18 2005, 11:02 AM
Try vbCrLf
lisa2004
Jan 18 2005, 11:16 AM
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
Larry Larsen
Jan 18 2005, 11:20 AM
Hi Lisa
+Chr(13)+Chr(10) work in reports..
lisa2004
Jan 18 2005, 11:28 AM
Great!!! This is a so cool place to share the ideas. Thanks for all of your response.
Lisa
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.