Report reading from form

  • Thread starter Thread starter van
  • Start date Start date
V

van

Hi

I have a form which is based on continuous view. On this form is a combo
box which feeds info into a report, on the report_open event. The code is
like:
Dim ctl As Control
For Each ctl In [Forms]![frm_test].Controls
If ctl.ControlType = acComboBox Then
Select Case [Forms]![frm_test]![Complete]
Case Is = 2
Var1.BackColor = vbGreen
Case Is = 3
Var1.BackColor = vbred
Var2.BackColor = vbred
End Select
End If
'Next

However, it is only lifting the value of the combo box from the very first
row of data, and then applying the condition to every row thereafter. Eg if
first line was 2, it would color all rows green, regardless of whether they
were =2 or not. Is this because the form is based on continuous view?
Conditional formatting has not worked for me.
 
Place your code in the On Format event of the section containing the
control. Also, once Var2 is made vbred, it will stay red since there is no
code to set it back to white or green or whatever.
 
Back
Top