Learn Access 2003 VBA with The Smart Method
58
www.LearnAccessVBA.com
Lesson 3-1: Understand
properties
What are properties.
The slide above shows three cars. We can recognise them all as cars but
there are some things that are different about them.
In object-speak we would say that the cars have different properties.
We can think of each as being a car object. If I were to telephone you and
say “I bought a new car" you wouldn’t know what color it was or
whether it was a hard top—but you would still have an abstract idea of
what was sitting in my driveway.
To better visualise the car you would have to ask a few questions like:
Is it a convertible.
What color is it.
To relate this to Access consider a Form object. Form objects have a
Caption property that puts the name of the form into the top blue bar.
If you added enough properties to the Car object you would eventually
be able to precisely describe every car on the planet.
This would solve Socrates’ bee problem too!
Session3
pg_0002
Session Three: The Object-Orientated Paradigm
© 2007 The Smart Method Ltd
59
Objects contain objects
The car object contains a windscreen object. It also has four wheel objects
that are identical (or at least very similar). In object-speak we would say
that the car object contains a windscreen object and a collection of wheel
objects.
The Access Form object contains a collection of control objects (such as
command buttons and text boxes).
How properties are set for controls
1
Examine the properties of the cmdDelete command button
on the frmFilm form.
Open the form in Design View, right-click the cmdDelete button
and choose Properties from the shortcut menu.
You can probably figure out what most of the properties mean.
note
Properties can be set both using
the properties dialog and via
VBA code.
For the moment we’ll only use
the properties dialog method
but when we know a little more
about the VBA programming
language we’ll be setting some
properties using VBA code.