[AccessD] More on vbCr, vbLf, VbNewLine, and vbCrLf

Gustav Brock Gustav at cactus.dk
Wed Dec 13 11:08:05 CST 2006


Hi Susan

Not commenting Charlotte's memory, these constants were all introduced in Access 97:

vbCrLf	Chr(13) + Chr(10)
vbCr	Chr(13)
vbLf	Chr(10)
vbNewLine	Chr(13) + Chr(10) (or Chr(13), Platform specific)
vbNullChar	Chr(0)
vbNullString
vbTab	Chr(9)
vbBack	Chr(8)

/gustav

>>> ssharkins at setel.com 13-12-2006 17:40 >>>
I don't suppose anyone knows -- off the top of their head -- when vbNewLine
showed up in Access? I'm going to check the ms library, but I usually can't
find that kind of information. 

Susan H. 

Hi Susan

That's what is dangerous. One day you may need it elsewhere and you may be
hosed.

To conclude: Using vbNewLine is the safe way as it is easy to remember and
performs correctly in any Windows environment.
However, in SQL it is not recognized and you have to fall back to Chr(13) &
Chr(10) for a new line. If that bothers you (not you, the SQL programmer)
because it messes up the SQL, create a tiny function which is easy to
remember and understand:

Public Function NewLine() As String
  NewLine = vbNewLine
End Function

and use that in your SQL.

/gustav

>>> ssharkins at setel.com 13-12-2006 00:00 >>>
I'm just dealing with message text in a message box. :) 

Susan H. 


Hi Susan

I meant that no matter what you type, Access will try to display it
correctly.

However, if you construct a string with the various constants and assign
this to a, say, textbox, you'll for the wrong constants meet the funny small
boxes instead of new lines. Try it.




More information about the AccessD mailing list