Cont.Form. Conditional formatting weirdness

CraigDolphin

GrumpyOldMan in Training
Local time
Yesterday, 23:46
Joined
Dec 21, 2005
Messages
1,578
I have a continuous form bound to a table containing a number of records pertaining to water quality sampling. One of the fields, Activity_category has a conditional formatting condition that counts records in the table that are 'duplicates' with regard to 4 of the fields in the table. (differences in other fields make no difference in regarding whether a record is a 'duplicate')

The conditional formatting works perfectly in one version of the form (during data entry) but does not work in another version of the same form (that is based on the same table, and that differs mainly by having different on_close events and some additional command buttons. 9The second form was created by copying and pasting the original, then making additions of command buttons etc).

The condition statement is the same in both forms but the formatting does not appear at all in the second version of the form even when records that meet the condition are in the table (see attached for example records).

The condition statement for the control on both forms is an expression as follows:
Code:
[ParameterID] Is Not Null And DCount("[ResultID]","tblSampleData","[ParameterID]=" & [ParameterID] & " AND [SiteVisitID]=" & [SiteVisitID] & " AND [SampleTaken]=-1 AND [SampleStrata]=" & [SampleStrata])>1

My only clue might be something to do with the second record in the duplicate record pair being entered after other data has been entered for other sites etc. Is it possible that the DCount stops counting for some reason once it encounters a record with a higher SiteVisitID number? (SiteVisitID is a foreign key from a different table). I thought DCount was supposed to count every record in the table meeting the criteria specified?

I have attached a copy of some records from the table in question in case I'm missing something obvious.

The two records that should trigger the condition are highlighted in blue. The four fields used as criteria in the condition have their field name highlighted in green.

Several records in between the two 'duplicate' records have been 'hidden' for the purpose of clarity. The TRUE/FALSE values are output from Yes/No fields so True represents a -1, and False represents a 0.

And to complicate matters further, if I view the form and randomly click in the activity_category control, then in another control on another record, /sometimes/ one of the two duplicates will highlight blue as they are supposed to. But after a lot of trying, I can't determine any pattern to when it might work and when it will just stay yellow (default).

Anyone else encounter something like this?
 

Attachments

Users who are viewing this thread

Back
Top Bottom