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

Charlotte Foust cfoust at infostatsystems.com
Wed Dec 13 13:03:09 CST 2006


It's OK, Gustav.  You're welcome to make fun of my memory. ;o}  I
suppose I just never bothered with vbNewLine when vbCrLf always worked
for me.

Charlotte Foust 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Wednesday, December 13, 2006 9:08 AM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] More on vbCr, vbLf, VbNewLine, and vbCrLf

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.

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list