CHR vs CHR$ 
Author Message
 CHR vs CHR$

Can anybody tell me the difference between the CHR
function and the CHR$ function ?


Thu, 08 Dec 2005 20:05:30 GMT  
 CHR vs CHR$


Quote:

> Can anybody tell me the difference between the CHR
> function and the CHR$ function ?

As defined in help, Chr() uses and returns a variant, while Chr$() uses an
integer and returns a string. The difference is:

  Chr(null) = NULL

  Chr$(null) = Error! Invalid use of null

HTH

Tim F



Thu, 08 Dec 2005 20:40:33 GMT  
 CHR vs CHR$
"... while Chr$() uses an integer ..."

That's new to me!???

--
HTH
Van T. Dinh
MVP (Access)


Quote:
> As defined in help, Chr() uses and returns a variant, while Chr$() uses an
> integer and returns a string. The difference is:

>   Chr(null) = NULL

>   Chr$(null) = Error! Invalid use of null

> HTH

> Tim F



Fri, 09 Dec 2005 00:06:50 GMT  
 CHR vs CHR$


Quote:

> "... while Chr$() uses an integer ..."

> That's new to me!???

Oops: did that from memory! This is from the object browser:-

Function Chr$(CharCode As Long) As String
    Member of VBA.Strings

but I can't imagine why it's such a big argument. A bit of research reveals
this:

  ? Chr$(256)

returns an Error 5: Invalid procedure call. Help says "The normal range for
charcode is 0 to 255. However, on DBCS systems, the actual range for
charcode is -32768 to 65535."

I've just discovered (funny what you find when you actually test these
things) that Chr(null) does return an Invalid Use of Null, so I guess my
answer to the previous question was completely wrong.

Well, it's been a long weekend!

Tim F



Fri, 09 Dec 2005 06:12:02 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. chr(10) and chr(13) in memofield gives |

2. Chr(10) & Chr(13)

3. Display chr$(30) & chr$(31)

4. Difference between chr(34) and chr(160)

5. Chr(10) and Chr(13) doesn't work

6. is carriage return chr(13) or chr(32)

7. INPUT OR READ TO STRIP CHR(10) AND CHR(13)

8. What is chr$(13) + chr$(10)

9. vbCRLF = chr(13) + chr(10)

10. No Sentences in Title?! / No Chr(10) or Chr(13) in titles!!!

11. TRUE or FALSE: chr$(152) < chr$(149) ?

12. Global Const CR = chr$(13) + chr$(10) uh oh!?

 

 
Powered by phpBB® Forum Software