Problem:
Everything was working fairly well, and then I added two fields to the form body (and the datasheet): "Impact" and "Interest". I set these to have conditional formatting, so that if they contain the text "red", they have a red fill.
When the form loads, the conditional formatting is instantly applied to the first entry in the datasheet view, and it takes a second to apply to the other two entries I put "yellow" and "green" in (which are conditioned to have a yellow and green fill, respectively). If I set the third entry to be selected when the form has loaded, this one has the formatting applied instantly to the datasheet view. MS Access says it is "Calculating", and when this finishes the conditional formatting is applied.
Further to this, when the first text filter is applied the form body text boxes "impact" and "interest" flicker, as well as the second text filter in the header and the "forename" of the selected entry in the datasheet view (my VBA code selects the forename after the filter is applied). When I move the mouse, the flickering stops and the filter applies. Sometimes the flickering doesn't happen, though. This has only happened since I added the "impact" and "interest" fields, with conditional formatting.
This is the basic structure of my form:
Form Header: A few buttons, and two text boxes. The user types in their search terms, and hit the "apply filter" buttons to narrow down the data shown in the datasheet view.
Datasheet view: The key columns are visible, and when the user clicks on one, it's profile is brought up in the form.
Form body: This contains the data from the datasheet, laid out according to category.
Here's the code for when my form loads - it loads all the relevant data, sets up a check box, and sets the focus on the first text filter:
Private Sub Form_Load()
Me.RecordSource = "SELECT * FROM Staff "
CheckImpInt.Enabled = True
CheckImpInt = False
StaffTotalSearchText1.SetFocus
End Sub
And here's the code for the first filter button:
Private Sub Filter1Button_Click()
If CheckImpInt = True Then
Me.RecordSource = "SELECT * FROM Staff " & _
"WHERE [Interest] Like '*" & Me![StaffTotalSearchText1] & "*'" & _
"Or [Impact potential] Like '*" & Me![StaffTotalSearchText1] & "*'"
Else
Me.RecordSource = "SELECT * FROM Staff " & _
"WHERE [Forename] Like '*" & Me![StaffTotalSearchText1] & "*'" & _
"Or [Surname] Like '*" & Me![StaffTotalSearchText1] & "*'" & _
"Or [Position] Like '*" & Me![StaffTotalSearchText1] & "*'" & _
"Or [Group] Like '*" & Me![StaffTotalSearchText1] & "*'" & _
"Or [Division] Like '*" & Me![StaffTotalSearchText1] & "*'" & _
"Or [All groups] Like '*" & Me![StaffTotalSearchText1] & "*'" & _
"Or [Expertise] Like '*" & Me![StaffTotalSearchText1] & "*'" & _
"Or [Institutes] Like '*" & Me![StaffTotalSearchText1] & "*'" & _
"Or [Roles] Like '*" & Me![StaffTotalSearchText1] & "*'" & _
"Or [skills - analysis] Like '*" & Me![StaffTotalSearchText1] & "*'" & _
"Or [skills - compute] Like '*" & Me![StaffTotalSearchText1] & "*'" & _
"Or [Notes] Like '*" & Me![StaffTotalSearchText1] & "*'" & _
"Or [Paired IC] Like '*" & Me![StaffTotalSearchText1] & "*'" & _
"Or [Paired Company?] Like '*" & Me![StaffTotalSearchText1] & "*' "
End If
End Sub