Need a "linebreak" in ColumnHistory (1 Viewer)

Holly_Associated

Registered User.
Local time
Today, 13:39
Joined
Mar 21, 2013
Messages
53
Hi All,

So I have an unbound textbox with the following:

=Replace(ColumnHistory("TblJob","Comments","[JobID]='" & Nz([JobID],"") & "'"),"[Version: ","[",1,-1)

Which is working perfectly except one thing... The 'histories' are displaying all together instead of a new history being on a new line:

(When in form view...)
[ 27/06/2013 15:20:43 ] Hello [ 27/06/2013 15:33:37 ] Hello [ 27/06/2013 15:43:36 ]

It has taken me a while to get this (my ID field is text not numerical) so I really hope I can now get the display correct :rolleyes:

Any help much appreciated!
 

Holly_Associated

Registered User.
Local time
Today, 13:39
Joined
Mar 21, 2013
Messages
53
Also, if a ColumnHistory expert happens to be looking, how do I get the 'histories' to show with newest at the top of the text box? I know it's possible as I've seen someone else mention it in passing (Lateefx) but they didn't give detail.
 

rzw0wr

I will always be a newbie
Local time
Today, 08:39
Joined
Apr 1, 2012
Messages
489
try vbCrLF

Dale
 

Holly_Associated

Registered User.
Local time
Today, 13:39
Joined
Mar 21, 2013
Messages
53
Hi Dale,

OK so I've just Googled this and it appears to be VBA code and there is one similar called vbNewLine??
If you would be so kind, my question is that I am typing the above in an unbound text box on a form in design view. I thought I had to open the (scary) VBA screen to put in VBA code? If I can put it in the form text box, where would it work best in the code without interrupting the ColumnHistory and Replace?
If I have to open the VBA window and type it in there, will it mess up the code in the form text box? Or do I cut the whole thing from the form and put it all in the VBA screen?
Excuse me if these are really stupid questions!

Edit: Sorry, more Googling and I have found &Chr(13)&Chr(10) so I will try that on the end of my code in the morning when back at my desk and let you know if it works!
 
Last edited:

Holly_Associated

Registered User.
Local time
Today, 13:39
Joined
Mar 21, 2013
Messages
53
Well, I tried the Chr(13)&Chr(10) before the replacement [ and it didn't work? I searched some more and it turns out you have to have the text box set to plain text and not rich text. So, my original code now works as:

[ 27/06/2013 15:20:43 ] Hello
[ 27/06/2013 15:33:37 ] Hello
[ 27/06/2013 15:43:36 ]


and with the extra:
=Replace(ColumnHistory("TblJob","Comments","[JobID]='" & Nz([JobID],"") & "'"),"[Version: ",(Chr(13)&Chr(10)&"[",1,-1)
it shows:

[ 27/06/2013 15:20:43 ] Hello

[ 27/06/2013 15:33:37 ] Hello

[ 27/06/2013 15:43:36 ]


Woohoo, you learn something new everyday and my box looks organised :D

Now if anyone knows how I can sort the date/time stamp so the newest appears at the top you will make my week!
 

rzw0wr

I will always be a newbie
Local time
Today, 08:39
Joined
Apr 1, 2012
Messages
489
The text box has to be large enough to hold the text AND the NewLine.
Correct, vbNewLine and vb CRLF are the same as far as I know.

Dale
 

Users who are viewing this thread

Top Bottom