Report reading from form

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.
 
D

Duane Hookom

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top