A user expects to see data, or at the very least, empty controls, in a form. Occasionally, a form presents a picture the user doesn’t expect — absolutely nothing, no data or controls. An empty form just frustrates and confuses users. They can’t continue with their work and they don’t know how to remedy the problem.
This empty-form behavior isn’t really a bug, but it is something you’ll want to inhibit before it occurs. Unexpected empty forms pop up when two conditions are met at the same time: There are no records to display and the form won’t accept new data. It’s difficult to stop this from happening because you must prevent both conditions from occurring simultaneously. The first step is to determine what’s causing each condition.
When a form displays no data, check the following possibilities:
- The underlying record source (that could be a table or a query) is empty.
- The form’s Data Entry property is set to Yes. In other words, the form accepts new records, but doesn’t display existing data. You can use the same form for both data entry and browsing by setting this property programmatically in the form’s Open event.
- The form’s filter property returns no records.
- A WHERE clause set programmatically against the form’s recordset returns no records.
When the form won’t accept new records, but you think it should, check these possibilities:
- The underlying record source is a read-only query. You must be able to update the record source to enter new records. Usually, checking the primary and foreign key fields in the query will expose the culprit.
- The form’s Allow Additions property may be set to No (which would inhibit new records). It’s counterproductive to set a form’s Data Entry property to Yes and its Allow Additions property to No. Most likely, this is a mistake you’ll have to hunt down.
- The form’s Recordset Type property isn’t Dynaset (see the following table).
|Dynaset||0||This setting (the default) lets you edit bound controls with a valid and updateable join in a one-to-one or one-to-many. You can’t edit data in the foreign key unless Cascade Updates is enabled.|
|Dynaset (Inconsistent Updates)||1||You can edit all bound fields.|
|Snapshot||2||You can’t edit data.|
While chasing down the problem of unexpected empty forms and correcting the cause is good, you won’t always be able to prevent an empty form. It’s an acceptable consequence of searching. However, it should never happen when the user expects to update data.