Help with the Dim commmand in VB

  • Thread starter Thread starter James Mckillop
  • Start date Start date
J

James Mckillop

Can anyone tell me what the Dim command actually does? I
am not sure what it is good for but see it a lot in the
stuff I have to edit.

Thanks

James
 
Dim is used to declare variables, arrays, constants, class
types, etc.,etc. It is used to describe (to Access) the
type of field it will be and allocates storage space.
See Access Help und Dim and Public statements for a more
in-depth descriptions.
You may also want to look up Access & VB naming
conventions. These are a kind of developer shorthand. They
are commonly used prefixes used by developers to specify
what type of variable they are using:

http://www.mvps.org/access/general/gen0012.htm
 
Dim statements are used to declare variables, whether they be objects such
as databases, recordsets, Outlook or Word objects, etc., strings or numbers.

More information can be found on the topic by opening VBA Help in Access and
searching on: Declaring Variables.

Hope this provided you the info you need.
 
If it helps, think of Dim as short for Dimension. When you declare a
variable you are setting it's name but you are also "dimensioning" it's
size/type: Variant (the default), string (size optional), byte, integer,
double, object (recordset, querydef, form, etc). You are telling the
program what you want to call your variable and how much space (it's
dimensions) to set aside for it.

The term "Dimension" is mostly associated only with arrays these days, but
it is still applicable to other variables, at least conceptually. It is a
bit archaic from disuse and therefore not as familiar.

Hope this helps,
 
Back
Top