Conditional formatting bug

        9 votes: *****     6,846 views      No comments
by Allen Browne, 20 April 2005    (for Access 2000+)

Flaws in Microsoft Access

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


Conditional formatting

If you apply conditional formatting to calculated controls, you may start an endless loop where the form recalculates continually and fails to display the results. This happens in Access 2000, and 2002. It also occurs in Access 2003 if Service Pack 1 has not been applied.

Demonstration

AccessFlaws.zip contains a form named Dates. It demonstrates the problem with just two text boxes: TheDate bound to a date field, and txtDueDate bound to this expression:
    =[TheDate] + 30

The idea is to allow 30 days for payment, and show the record in red if that date has already past. The txtDueDate text box has Conditional Formatting (Format menu) for the condition:
    [txtDueDate] < Date()

However, when you open the form, you see txtDueDate is displayed for the first row only. The status bar reads "Calculating..." constantly, and the calculation never completes for subsequent rows of the continuous form.

Because of this failure, you will see other weird behaviours as well. For example, a text box may receive focus, even if its Enabled property is set to No. A system with limited resources may even crash.

Workaround

Avoid using conditional formatting where the endless recalculation loop is triggered.


Update February 2007

This problem still occurs in Access 2003 under certain conditions (the mouse cursor over a combo in a subform when the form is opened, if the combo has conditional formatting and a zero-width bound column.)


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 'Conditional formatting bug'?

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).