team lib

In this chapter we've started to look into the object world, looking at the objects that Access has built in. This has concentrated on some of the main ones, such as forms, controls, and so on, but you will be seeing more throughout the rest of the book.

An important thing to remember from this chapter is collections. If there is more than one of a given type of object then it may be contained in a collection, with the collection name usually being the plural of the object. So to hold the form objects we have a Forms collection. Looping through these collections is easy with the For Each statement, so you can easily examine every item. To avoid hard-coding our code, we loosely couple it by making use of the index of an item in a collection - this cuts down on maintenance and supports code reuse in other Access applications: we also saw how the Me property helps us to loosely couple our code.

Once you have an object you can refer to its methods and properties, such as the FontName property for controls. So, from within your code, you have access to almost everything that you have access to when in design mode. This is a very powerful feature, and you'll see much more of it later. But for now, it's time you learned about data access.

team lib

Beginning Access 2002 VBA
Beginning Access 2002 VBA (Programmer to Programmer)
ISBN: 0764544020
EAN: 2147483647
Year: 2003
Pages: 256 © 2008-2017.
If you may any questions please contact us: