Dynamic report formatting

L

Leif

In some forms I have a group of combo boxes that may have a Yes or No answer.
Associated with that combo box is two or three text boxes.

I've programmed the forms such that if the user enters Yes then the
background color of the associated text box is changed. That works fine.

I've copied the form fields to a report. I tried using the same code that
highlights certain text boxes when the combo box is Yes. However, the
problem is that it seems to takes its que from the first record. Only those
combo boxes from the first record are being used to highlight the text of
other records, even when the combo box is No.

I've tried using both the On Format and On Print events in the detail
section of the report, same result.

I also tried using the On Page event from the full report events. That does
not highlight the first page, however the second and third pages follow the
Yes pattern of the first page (record).

What I need is to highlight the Yes values and have it do that independently
for each report record.

Regards,
Leif
 
M

Marshall Barton

Leif said:
In some forms I have a group of combo boxes that may have a Yes or No answer.
Associated with that combo box is two or three text boxes.

I've programmed the forms such that if the user enters Yes then the
background color of the associated text box is changed. That works fine.

I've copied the form fields to a report. I tried using the same code that
highlights certain text boxes when the combo box is Yes. However, the
problem is that it seems to takes its que from the first record. Only those
combo boxes from the first record are being used to highlight the text of
other records, even when the combo box is No.

I've tried using both the On Format and On Print events in the detail
section of the report, same result.


The detail section's Format event is normally the best place
to do this. I suspect that you forgot to set the
highlighting for both the yes and the no cases. E.g.

If sometextbox = "Yes" Then
sometextbox.BackColor = vbGreen
Else
sometextbox.BackColor = vbBlack
End If

Another approach to this question would be to use
Conditional Formatting (Format menu) on the text boxes.
 

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