Help with the Dim commmand in VB

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
 
J

jmonty

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
 
C

Cheryl Fischer

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.
 
G

George Nicholson

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,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top