This is a book about VBA, so let's talk about code. More specifically, you'll explore some examples that use specific events and properties such as CanGrow and CanShrink, and then move into some of the more common types of reports that you can create with just a little VBA. Let's start with some of the basics.
To add a module to a report, simply add an event handler for an event such as Open, or set the HasModule property of the report to Yes.
As you add controls, or even when you name fields, there are a few things to keep in mind that make the process of creating queries, forms, and reports much easier. The first is to avoid the use of spaces or punctuation in field and control names. Spaces may make your field names easier to read, but they are not user-friendly when it comes to queries or code. Consider a field named Last Name with a space in the middle. This field name must be bracketed when used in a query. Without the space, brackets are not required. It turns out that brackets are also required when you refer to the field in code, so instead of referring to the field like this:
you must refer to it like this:
As you can see, using the space in the name makes it harder to read and write in code. Instead, don't use spaces in names; use the Caption property of a field or label control to change the displayed text.
Another issue that causes problems is circular references. A circular ...