Formatting detail records based on a field value not shown in the report

  • Follow


Hi.  What's the general syntax for formatting report detail controls'
forecolor based on the value of a field in the report's data source
that isn't shown?

Background: My report's data source includes a field called
IS_HIGHLIGHTED (yes/no data type).  I want to highlight the forecolor
of several detail section controls red if the user checks IS-
HIGHLIGHTED for a record in the underlying table.

Is this a Detail_Print action or a Detail_Format action...?

Thanks!

0
Reply Tom 3/26/2007 9:18:13 PM

Tom wrote:

>Hi.  What's the general syntax for formatting report detail controls'
>forecolor based on the value of a field in the report's data source
>that isn't shown?
>
>Background: My report's data source includes a field called
>IS_HIGHLIGHTED (yes/no data type).  I want to highlight the forecolor
>of several detail section controls red if the user checks IS-
>HIGHLIGHTED for a record in the underlying table.
>
>Is this a Detail_Print action or a Detail_Format action...?


Generally, format affecting actions are done in the Format
event, but I think this one could be done in either.

OTOH, you do not need any code if you are using A2K or
later.  Instead use Conditional Formatting (on the Format
menu).  This is done by selecting the Expression is option,
setting the expression to:
	[IS_HIGHLIGHTED]
and selecting the highlight color in the ForeColor property.

-- 
Marsh
MVP [MS Access]
0
Reply Marshall 3/27/2007 12:02:48 AM


Access completely rebuilds each report's RecordSource behind the scenes and 
eliminates any field that isn't actually bound to a report control.  That 
means that you need to assign the field to a control (it can be hidden) in 
order to refer to it.  As Marsh said, either conditional formatting (if 
there are a maximum of 4 variations) or the onFormat event of the detail 
section.


Select Case Me.SomeField
  Case "a"
        Me.SomeOtherField.Forecolor = vbRed
  Case "b"
        Me.SomeOtherField.Forecolor = vbGreen
  Case "c"
       Me.SomeOtherField.Forecolor = vbBlue
   Case Else
       Me.SomeOtherField.Forecolor = vbBlack
End Select

"Tom" <thomas.utley@gmail.com> wrote in message 
news:1174943893.076680.179420@d57g2000hsg.googlegroups.com...
> Hi.  What's the general syntax for formatting report detail controls'
> forecolor based on the value of a field in the report's data source
> that isn't shown?
>
> Background: My report's data source includes a field called
> IS_HIGHLIGHTED (yes/no data type).  I want to highlight the forecolor
> of several detail section controls red if the user checks IS-
> HIGHLIGHTED for a record in the underlying table.
>
> Is this a Detail_Print action or a Detail_Format action...?
>
> Thanks!
> 


0
Reply Pat 3/27/2007 1:14:12 PM

2 Replies
383 Views

(page loaded in 0.07 seconds)

Similiar Articles:
















7/13/2012 11:48:13 AM


Reply: