We have a program that runs on a linux machine that outputs a text file. The description field has \n as line breaks.
here is an example:
\nSynopsis :\n\nError on machine.\n\nDescription :\n\nThere is a report of volnerability\nthis would make the computer at risk\nSolution :\n\nSolution:\nInstall new patches
Is there a way to make the \n as line breaks on a report or form?
I currently just have an imported table that has a findingID and then the description, which is the data above.
Have you tried using the character codes for carriage return and line feed if "/n" is in the string?
I've added textboxes to reports and if I add "Chr(13) & Chr(10)" to the textbox it will do a break. I would think that you should be able to setup something similar using the instr and replace functions to accomplish your task.
FYI...be careful when using "Chr(13) & Chr(10)" in a textbox (can't be a label) on your report. I've had mixed results in the past if I only used "Chr(13)" or "Chr(10)" without the other to accompany it.
Interesting. I've always used vbCrLf, but it seems that is exactly the same as vbNewLine (which I didn't know about). That should certainly do the trick anyway. Essentially what Beacon was proposing, but using the inbuilt named values instead.
Coming from the days where CR & LF were used individually (but together) the vbCrLf always made sense to me, but I can see why vbNewLine would appeal generally. I'm inclined to agree it's a more general and easily understood version. I may just have to switch now I've learned about it :)
You're telling your age now, NeoPa! I , too, come from that time! I started coding in QuickBasic 4.5, which was later used as the engine for VB and hence VBA. When people complain about how hard it is to do this or that in VBA I just have to laugh! I remember having to write a page-and-a-half of code to add a given number of weeks to a date! VBA is way more powerful than most people realize!
Although I came across some versions of BASIC in my earlier career, the time I'm talking about I hadn't done any. At that time it was all Assembler, COBOL & RPGII. When I moved on to C in the early 80s they introduced the \n, which handled new lines, but it was far less hardware dependent by then.