Incorrect displaying of data in forms (bugs)

        6 votes: *****     6,467 views      No comments
by Allen Browne, 20 April 2005    (for Access 95+)

Flaws in Microsoft Access

Provided by allenbrowne.com, January 2004, Updated February 2007


Incorrect display of data

The detail section of a form will be completely blank if a) there are no records to display, and b) no new records can be added. As a design decision, that is acceptable. However, controls in the Form Header or Form Footer sections are visible but do not display correctly.

To demonstrate the problem with AccessFlaws.zip, open the MissingDisplay form in design view. Its Record Source matches no records, and Allow Additions is set to No. That means we will not see the text boxes in the detail section, but look at the two text boxes in the Form Header section:

  • Text0 is bound to the expression, "Hello world";
  • Text1 is unbound, so can accept a value.

Open the form in form view. Text0 is visible, but does it display its expression? Attempting to read the value of the text box results in a nonsense message that the expression does not have a Value (Error 2427). Attempting to read the Text in the text box results in another message (Error 2185) that it must have focus to read the Text property - even though the control does have focus (as demonstrated by the Show Text0 command button). Access is thoroughly confused.

Click the command button Set Text1. The message, "There IS data here." should appear in Text1. It does not display. Clicking Show Text1 proves the data is in the control, though Access does not display it. You may even be able to click in Text1 and move the cursor along the invisible characters.

There are other cases where Access fails to display data also. Another common one involves a combo box with a zero-width bound column and a RowSource assigned dynamically in the form's Current event. Again, the combo displays completely white even though the value can be read from its Column() property. If the combo has focus, the reverse-video selection is the right number of characters wide, but Access is not displaying the text. This appears to be a timing issue, i.e. the RowSource provides the Column data after the screen has been drawn. (It is different from the perfectly valid case where the Row Source is restricted in such a way that there is nothing in the Column for Access to display.)

Update, May 2006: You can sometimes work around this problem by placing a text box behind the combo, forcing it to read the value of the display column. For example, if the combo is named Combo1 and the second column is displayed, set the text box's Tab Stop property to No and Control Source to:
    =[Combo1].[Column](1)

Access 2000 and 2002 had another display problem if a memo field was placed in the footer of a continuous form. For an example of this bug, download BadMemoFooter.zip. That problem seems to be fixed in Acc. 2003.


February 2007 update (not included in sample database.)

Vertical labels disappear

If you set the Vertical property to Yes in a text box or label, the text is likely to disappear in Access 2002 or 2003 on Windows XP. The issue does not occur under Access 2000, and does not occur under Windows Vista. Microsoft acknowledges the problem, but does not offer a solution.

Workaround: Set the font of your label/text box to Arial CYR. Thanks to Stephen Lebans (Access MVP) for identifying the cause as an issue with Unicode fonts.

Subform disappears

On a form with subforms in the pages of a tab control, if you hide the first page in the Open event of the form, the subform on the second page is not displayed. You can actually type into the controls of the subform, but you cannot see what you are typing.

Workaround: After hiding the first page, SetFocus to the second page. Access will then redraw it. The Open event procedure will now look something like this:

Private Sub Form_Open(Cancel As Integer)
    Me.pge0.Visible = False
    Me.pge1.SetFocus
End Sub

Thanks to Giorgio Rancati (Access MVP) for suggesting this workaround.


Home Index of tips Top

Rate this article:  Your rating: PoorYour rating: Not so goodYour rating: AverageYour rating: GoodYour rating: Excellent


This is a cached tutorial, reproduced with permission.

Have your say - comment on this article.

What did you think of 'Incorrect displaying of data in forms (bugs)'?

No comments yet.

Why not be the first to comment on this article?!

Have your say...

Name
E-mail (e-mail address will be kept private)
Comments


Comments require approval before being displayed on this page (allow 24 hours).