Reputation: 5834
A simple question, doing my head in...
I have a large access database to clean up.
Is there a system constant for a line break in Access (Like VB's VBCrLf)?
If not,I guess I'll just have to use Chr(13) + Chr(10)
Upvotes: 14
Views: 71371
Reputation: 15384
While vbCrLf, vbCr and vbLf exist, it is better to use vbNewLine.
Why?
1) Because vbNewLine will output the newline sequence for the current operating system (which may change) vs the other three which will put out only the carriage return and linefeed characters.
2) Because it is less cryptic. Using vbCr is just about as bad as chr(13)
The logical comeback is... come on when is MS ever going to change the newline, they'd be nuts. As it is, portability. There are already .Net ports to unix/linux and there is no reason that MS access can't be emulated there either. (E.g., perhaps in Wine)
Edit
A parallel to this idea would be using \n in C and C++ vs entering \f\r. \n will give you the native newline sequence (even if you flip from Unix to Windows to Mac to Vax to QNX). No conditional statements, no edits. It just works.
Upvotes: 9
Reputation: 300559
In VBA, vbCrLf
is the line break constant (along with vbCr
and vbLf
).
In a string data column, it's Chr(13) + Chr(10)
(which is what vbCrLf
is defined as).
Upvotes: 22