[AccessD] ORDER BY BUG using Date format AARHG

Gustav Brock gustav at cactus.dk
Sat Apr 3 07:53:34 CST 2004


Hi John and Stuart

Yes, I know about type declarations and variables - I only use Variant
when Null is an acceptable "value". 

But that was not my question ...

  Dim strVar As String

Now, 1. or 2.:

  1. strVar = Str(1234)
  2. strVar = Str$(1234)

Both Str() and Str$() cannot return anything but a string - the only
difference I can find is that Str$() returns a string while Str()
should return a variant with the undertype String.

But why would I care? Isn't a string a string?
Speed could be a concern. But testing with a loop with 2 mio.
iterations doesn't show any difference between Str() and Str$().

So do we see ghosts here? Why would I go on typing unneeded $ signs?

/gustav


> I never understood the difference. Contrary to what you tell, I've
> learned as well, and the on-line help (A97) tells, both return VarType
> vbString (8). 
> How could one ever tell a difference between 8 and 8?

> This could be a subject for Susan:

>   Why always use ..$() when possible, when nearly no one does ...

> /gustav


>> To be strictly correct, Format() returns a variant of type String.
>> Format$() returns a string.

>> Most of the string manipulation functions have two varieties , with 
>> and without a trailing "$".  Leaving the "$" off returns a variant 
>> with the additional overhead and potential problems of using that 
>> data type.  It's a good idea use the specific version wherever 
>> possible.




More information about the AccessD mailing list