Conditional formatting of reports using VB

J

Joan in Syracuse

Is it possible to use VB to do conditional formatting for
a report?

If fiedname= fieldname (C=PART_NUM+ I want the line style
to be solid.
If fieldname is true (C2300 = "-1") I want the field to be
grey. ( or red...)

Thanks for any input.
 
M

Marshall Barton

Joan said:
Is it possible to use VB to do conditional formatting for
a report?

If fiedname= fieldname (C=PART_NUM+ I want the line style
to be solid.
If fieldname is true (C2300 = "-1") I want the field to be
grey. ( or red...)

I'm not sure I understand your If conditions, but maybe you
want something like:

If PART_NUM = "C" Then
textbox.BorderStyle = 1 'solid
Ense
textbox.BorderStyle = 3 'dashes
End If

If C2300 = True Then
textbox.BackColor = vbRed
Else
textbox.BackColor = vbWhite
End If
 
G

Guest

-----Original Message-----


I'm not sure I understand your If conditions, but maybe you
want something like:

If PART_NUM = "C" Then
textbox.BorderStyle = 1 'solid
Ense
textbox.BorderStyle = 3 'dashes
End If

If C2300 = True Then
textbox.BackColor = vbRed
Else
textbox.BackColor = vbWhite
End If
Thanks for the info. I I may, I have a couple of more
questins. Do I set this up as an event procedure for the
report or as a function? If it is set up as a function,
how do I get it connected to the report? Thanks in
advance.
 
M

Marshall Barton

-----Original Message-----
Thanks for the info. I I may, I have a couple of more
questins. Do I set this up as an event procedure for the
report or as a function? If it is set up as a function,
how do I get it connected to the report?


Use the event procedures. Even if you want to place it in a
separate procedure, you would call it from an event
procedure.

The kind of code above should be in the Format event of the
section containing the text box with the properties you're
setting.
 

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