[AccessD] Integer v. Long

Rocky Smolin rockysmolin2 at gmail.com
Mon Sep 5 08:58:24 CDT 2022

I usually only use Long if referencing a PK which could easily got of 32k.
Or working with record counts. Occasionally I'll have an app where an
integer could go over 32k - like weight in pounds of metals which can go to
several tons. However, my use of integer goes back to the 1960s when memory
was at  a premium. I also still name my temporary counters intI, intJ,
etc., which goes back to Fortran where variables beginning with I,J,K,L,M,
and N were integers.


On Mon, Sep 5, 2022 at 1:15 AM Arthur Fuller <fuller.artful at gmail.com>

> Frequently I encounter code (most often in samples but sometimes also in
> examples, and even in code made available for public consumption) in which
> the developer declares numeric variables as Long rather than as Integer.
> This practice strikes me as a lazy habit.
> Data Type Low Range High Range Storage Requirement (bytes)
> Integer -32,768 32,767 2
> Long -2,147,483,648 2,147,483,647 4
> Granted, if storage and performance were critical, one would probably not
> code in VBA. But for most practical purposes in VBA, it seems to me that
> Longs are overkill.
> Opinions?
> --
> Arthur
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com

More information about the AccessD mailing list