Changing Field property on continuous form

L'apprentis

Redcifer
Local time
Yesterday, 23:27
Joined
Jun 22, 2005
Messages
177
I have created an unbound "search form" with a subform bound to a query. The default view of the subform is set to continuous which, allow me to see each record of the query in a single row (all field are tagged "Row").
One of the the Query field "Boolean" as a Yes/No format.
I have written a code that would highlight only the record row with the field boolean="true".
When the form is loaded all the field are highlighted even when "Boolean"=False, I don't understand why? Is anybody has any idea on what to do to make the code work?

Here is the code:

Code:
Private Sub Form_Current()

Dim ctl As Control
If Me.Boolean = "-1" Then
    For Each ctl In Controls
    If ctl.Properties("Tag") = "Row" Then ctl.Properties("FontBold") = True
    Next ctl
    Else
    For Each ctl In Controls
    If ctl.Properties("Tag") = "Row" Then ctl.Properties("FontBold") = False  
   Next ctl

End If
End Sub
 
Last edited:
Hi,

I think Access is evaluating the expression Me.Boolean for only the first row in your result set, so all controls in all rows are either bold or not bold. To achieve what you want, you need to use Conditional Formatting on each control, you can access this through the Format > Conditional Formatting menu when you have selected a field.

Hope that helps,
Keith.
 
Keith, you are right,
Access is only evaluating trhe first row of the records. I understand the formatting method but this will only highlight the field "boolean", the ideal situation would be that when the field "boolean" is highlighted for 1 record, all the corresponding field are highlighted as well. Would it not be possible to achieve this?
 
Hi,

You would have to apply the same Conditional Formatting to all fields, use the "expression" setting in Conditional Formatting and type expression = <Boolean>.

Keith.
 
Spot on Keith, I didn't think it would work but it is working. Thanks for your help.
Fred,
 

Users who are viewing this thread

Back
Top Bottom