Microsoft Office Courses, Microsoft Office Course Microsoft Office Training, Horsham, Brighton, Sussex, Surrey, Hampshire, London
 
Microsoft Office Courses, Microsoft Office Course Microsoft Office Training, Horsham, Brighton, Sussex, Surrey, Hampshire, London

On Site Training

Free Training Materials
Microsoft Office Courses, Microsoft Office Course Microsoft Office Training, Horsham, Brighton, Sussex, Surrey, Hampshire, London

Web design

 

If you like this site, let us create a web site for you.

Contact us for a quote.

 
 
 
Microsoft Office Courses, Microsoft Office Course Microsoft Office Training, Horsham, Brighton, Sussex, Surrey, Hampshire, London

Corporate portraits

 
Portraits for promotional material, web sites or just to decorate your office walls. See Kate's recent commissions
 
 
 
Microsoft
Office Training
SEO & Social
Media Training
Web Design
& SEO
Graphic Design   Prices Client Feedback About Contact
Microsoft Office Training throughout West Sussex & East Sussex, Surrey and Hampshire: Horsham, Brighton, Burgess Hill, Chichester, Crawley, Eastbourne, East Grinstead, Haywards Heath, Lewes, Littlehampton, Dorking, Farnham, Godalming, Guildford,Redhill, Reigate, Weybridge Woking, Havant, Petersfield, Portsmouth, Southampton, Winchester, Tonbridge & Tunbridge Wells.
Microsoft Office Courses, Microsoft Office Course Microsoft Office Training, Horsham, Brighton, Sussex, Surrey, Hampshire, London

Free Access Training - Access VBA: Storing Data in Variables and Constants

 

 

Microsoft Office Training > Access Training > Free Computer Training >Access VBA: Storing Data in Variables and Constants

Please feel free to use this content on your web site, but please include the links at the end.

Access VBA: Storing Data in Variables and Constants


A variable is a chunk of information
A variable has a name and a datatype
A variable has a value

Use a  Dim statement for variables (two lines)

Dim name As type
name = value

A constant is a value that does not change.  There are lots of inbuilt constants in VBA, but to create your own, use the following syntax:

Const name As type = value

 STORING DATA IN ARRAYS
An array is a collection of variables or constants.   An array allows you to create multiple variables or constants in one go.  To create an array you add a dimension value which tells VBA how many variables exist in the array:

Dim name(dimension)As Type

Dim mytest(5) As String

Creates the following variables

mytest(1)
mytest(2)
mytest(3)
mytest(4)
mytest(5)

DATA STORED AT THE MODULE LEVEL
Date stored in variables, constants and arrays, has both a lifetime and a scope.  Both these things are defined by where the variable is defined within a module.

To assign values to variables, arrays and constants for a whole module, you place the data at the top of the module under
Option Compare Database

These variables are public as they are available to all procedures in the module

DATA STORED AT A PROCEDURE LEVEL
Data stored within a procedure, is private, in that it is only available to that procedure.

NAMING CONVENTIONS FOR VARIABLES
Name variables with a three letter prefix that indicates the type of data variable:

Byt      byte
Cur      Currency
Dtm     Date/Time
Dbl      Double
Int       Integer
Lng      Long
Sng      Single
Bln      Boolean
str        String
var       Variant


Microsoft Office Training with Blue Pecan Computer Training. Tailored Microsoft Access Training.

 

 

 
Microsoft Office Courses, Microsoft Office Course Microsoft Office Training, Horsham, Brighton, Sussex, Surrey, Hampshire, London

Access training offerings

 
  
Microsoft Office Courses, Microsoft Office Course Microsoft Office Training, Horsham, Brighton, Sussex, Surrey, Hampshire, London

Application resources

More free Tutorials on Tech Tutorials

 

Home |   On-site Training  |   Prices   |   Client Feedback  |   About Us |   Contact Us  | UK Photography & Sussex Photography | Sitemap

Copyright (c) 2010 Blue Pecan. All rights reserved.