[AccessD] ORDER BY BUG using Date format AARHG

John W. Colby jwcolby at colbyconsulting.com
Sat Apr 3 05:38:40 CST 2004


Gustav,

The differences center around the fact that the result is returned as a
variant if you don't use the $.  The obvious differences are:

1) Specified datatypes are faster.  Variants supposedly carry a penalty
since they have to be "interpreted" to figure out what they are.
2) A Variant can be coerced without warning into another datatype.  This may
be exactly what you want and then it's ok.

For example if the string holds a date, and you try to return the $ function
into a variable dimensioned as date, it will complain and you will know that
is happening.  If you return the function without the $ it will just be
coerced into a date and you will never know.

Again, you may indeed be aware that the string is a date and WANT it
coerced, but if your intention is to keep it in string format and
inadvertently dim the destination as a date instead of a string, then one
function will immediately make you aware of your error.

John W. Colby
www.ColbyConsulting.com

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Gustav Brock
Sent: Saturday, April 03, 2004 5:41 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] ORDER BY BUG using Date format AARHG


Hi Stuart

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.

--
_______________________________________________
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