This sample db demonstrates an interesting approach to conditional highlighting of datasheet forms. It is remarkably generic, using a set of functions in general module and does not depend upon any primary key field. In fact, no field name or form name is used and hardly any code is needed in the form module (except for style (b) below).
Following styles for highlighting the records are covered:
(a) Highlight current record, First record, new record.
(b) Flag desired row or rows by dbl clicking (Dbl click again to remove the flag).
Once a flag is set for a record, and unless it is removed subsequently by user action (another dbl click on flagged record), it remains in force for current database session, even if the form is closed and then re-opened.
(c) Highlight odd rows.
(d) Highlight even rows.
(e) Highlight every third row.
(f) Highlight top - mid - last row.
(g) Highlight top 2 - mid 2 - last 2 rows.
Note: The solution is equally applicable to continuous forms.
Version: Access 2000 file format.
You can find the sample here: http://www.rogersaccesslibrary.com/forum/Form-datasheethighlightstyles_topic561.html