[AccessD] explicit type

John Colby jcolby at colbyconsulting.com
Thu Oct 2 10:16:14 CDT 2003


I don't know why developers don't do this but I do.  Much of the reason of
using a specific type is to force VB to use a specific data type to hold
whatever is being stored, which in turn prevents doing stupid things like
storing currency in strings etc.

John W. Colby
www.colbyconsulting.com

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of John B.
Sent: Thursday, October 02, 2003 10:51 AM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] explicit type


Stuart,
Thanks, I can't even remember what my issue was now, wrote that a 2:00 AM...

I ran FMS Analyzer on an app and found that none of my constants have ever
been explicitly typed - even those from procedures I obtained from other
people, ADH, etc. Maybe that was the issue: Why don't they do it why?

JB

> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Stuart
> McLachlan
> Sent: Thursday, October 02, 2003 4:39 AM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] explicit type
>
>
> On 2 Oct 2003 at 1:56, John B. wrote:
>
> > Just cleaning some code and I was wondering how much difference
> is it going
> > to make if I declare this:
> > Const conPropNotFoundError = 3270
> > If Err = conPropNotFoundError Then...
> > versus this:
> > Const conPropNotFoundError as Long = 3270
> > If Err = conPropNotFoundError Then...
> >
>
> If you don't declare it explicitly, it will be declared as a Variant
> with all of the overhead of storing/interpreting variants.
>
> How much depends on how you are using it. The more you use the
> constant, the more overhead you incur.  As a general rule -  declare
> all variables and constants as the most efficient data type for its
> purpose and only use variants if they are unavoidable.
>
>
>
>
>
>
>
>
> --
> Lexacorp Ltd
> http://www.lexacorp.com.pg
> Information Technology Consultancy, Software Development,System
> Support.
>
>
>
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
>


_______________________________________________
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