Databases - Opening a Form or Report

How to open forms and reports using code.

Paradox | MS Access | Delphi | Visual Basic | Java


Paradox

The following Paradox 5.0 code is from a form which is used to select and open other forms.


Reports

Opening reports can be a bit more complicated. The edit option allows the user to modify the query. (All my forms and reports are based on aliases which are changed on the fly based on which dataset and version the user selects.)


Report Footers

Typically, my reports are printed via a form which allows the user to pick the report, dataset, dataset version, and query. Eventually, someone will want an updated copy. Based on only hardcopy, it is hard to know exactly which options were used. Of several hundred reports, which one is it?

Well, to solve that problem, I allow the system to generate a footer which identifies enough information to reproduce the report. The data is passed using EnvironmentStrings which are read using a calculated field.


MS Access 97

For OpenReport to work, the report MUST BE CLOSED. If the report is open, subsequent OpenReport statements actually do nothing.

Both of these Where clauses will work. (Notice the quote marks.)


Opening Forms Based on Aggregate Queries

Aggregate queries contain functions like Count and Sum and contain a Group by clause.

I have a situation where I want the calling form to modify the Where clause of an Aggregate query. However, it appears that the query is run before the wherecondition is applied, thus producing the wrong results. The solution is to


Passing a Parameter Example

The following example is from the help. It shows one method to open a form and then locate a specific record based on a passed parameter. When an assignment fails in Form_Open try Form_Load.


Changing the Form View

MS Access allows forms to be displayed in normal and datasheet formats. There is a problem adding this code to a double click event of a sub-form This can be "fixed" with the following code.


Custom Dialog Boxes

Creating and using custom dialog boxes is too complex to cover in this page.


Delphi 5.0 - Visual Basic 6.0 - Java

This information is presented on my Comparing Computer Languages page on displaying forms.


Author: Robert Clemenzi - clemenzi@cpcug.org
URL: http:// cpcug.org / user / clemenzi / technical / Databases / Open_a_Form.html