The "Could not compile program" error within ReportBuilder indicates that there is a problem with one of the events of the report. If you have deleted or renamed any objects on a standard report, there is most likely code in one of the event handlers that are still pointing to the old or deleted object name.
To track these types of errors down, you will need to do the following:
- Open up the report in the designer.
- Preview the report to get the name of the event or object that is causing the error.
- Click on the "Calc" tab of the report designer.
- Click on the "View" menu and and select the "Module" view. This will display all of the event handlers for the currently selected report or sub-report in the right hand box.
- Look for any event handlers that have a red icon to the left of the event handler name. This indicates that there is an error in that event.
- Click on the first event that has a red icon to display the event code in the lower portion of the calc tab.
- At this point, you need to correct the code in this event to get it to the point where it will compile. Right click on the code for the event handler, and select "Compile" from the popup menu. Just below the code window, the results of the compile will be displayed to show you where the problem is.
- It will most likely tell you that there is an undeclared identifier. This means that the code is trying to access an object or property that does not exist. If you have deleted an object from the report, you need to find the code that references that object and remove it as well.
- Repeat steps 5 through 8 until you no longer see any event handlers with a red icon.
- If there are still problems with the report after cleaning up all of the event handlers, you will need to select each of the sub-reports (if there are any) for event handlers that have errors by selecting the sub-reports one at a time from the tabs at the bottom of the calc page. When you select a new sub-report, all of the event handlers for that sub-report will visible, and the events that have errors will be highlighted with the red icon.