O'Reilly logo

Access 2003 VBA Programmer's Reference by Armen Stein, Graham Seach, Teresa Hennig, Patricia Cardoza

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

11.4. When Not to Use VBA

There are times when you will attempt to solve a problem with VBA, only to find out that VBA is not the answer. The following example is such a case. Over time, you will learn to identify what can be solved with code, with a query or multiple queries, and also via the use of controls on a report.

When developing a report, there are things that you can do that don't require programming. Instead, with a properly placed control, or with the use of a grouping section, the desired functionality can be achieved. In this example, an index letter can be added to the start of each Alphabetical value in the report. This can be helpful for easy recognition of data by the user. Figure 11-11 demonstrates the desired effect.

Figure 11.11. Figure 11-11

In this report, each product is listed alphabetically. Where one letter ends, and the next begins, the starting letter is printed to assist the reader with locating their desired value. This functionality could be programmed in the report writer, but is easily implemented with just a text box control and a group.

Figure 11-12 displays the report called Alphabetical List of Products, which comes with the Northwind database example.

Figure 11.12. Figure 11-12

In Figure 11-12, notice that there is a report section called ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required