4 Using a Loop

After a big detour to introduce RecordSet, it is time to back track to the topic of this module: loops.

A loop is useful when you want to do something repeatedly. For example, let’s say you have some operation to perform on records of a table that cannot be done in SQL. You can do this with a RecordSet and a loop.

It is important to reemphasize that many operations can be done natively with SQL and other built-in features of Access. It is relatively rare that you have to rely on VBA. We will use a somewhat semi-realistic example here.

 4.1 Start with a Contact database
 4.2 Modify the “Contacts” table
 4.3 Create an empty form
 4.4 Writing the VBA code