Enhancing Reports with VBA

This chapter focuses on the ability to modify Access Reports using VBA programming. If you have read the chapter about enhancing forms, then in this chapter you will recognize many of the same concepts that occurred there. There are many similarities, in that each object has its own properties, which can execute an event procedure. For example, the Form object has an Open event procedure and the Report object has one as well. Once you learn how to utilize an event procedure for one object, using that same event procedure in another becomes very simple.

When programming for a form, there are certain issues to worry about, such as application flow, searching for data, entry of data, and data validation. Almost none of this needs to occur when programming for a report. By the time a report executes, the data should already exist within the tables, and the report is just a printed copy of the information.

The examples contained within this chapter will get you on the road to solving challenging reporting problems that you may come across. It will start with a discussion of the available event properties, and will then move to specific examples. The specific examples are structured to demonstrate functionality that can be added to an event procedure. Specifically, the Open, No Data, Format, and Print event procedures are addressed. After these techniques are understood, the common problem of computing a running balance is addressed. The last example demonstrates how to solve a reporting problem without using VBA.

0 0

Post a comment