Conditional format.

B

Bdavis

In a report, I want only the first row of detail to have a "$" sign and all
subsequent detail records to be currency but no "$".


How can I do this?
 
F

fredg

In a report, I want only the first row of detail to have a "$" sign and all
subsequent detail records to be currency but no "$".

How can I do this?

First set the Format property of the control to:
$#,###.00

Next...
Add an unbound control to the detail section.
Set it's control source to
=1
Set it's Running sum to Over all
Name this control "RecCount"
You can make it not visible.

In the Detail Format event, code:
If [RecCount] >1 then
[YourControl].Format = "#,###.00"
End If
 
B

Bdavis

Hey Fred,

This worked however, I have 7 controls in the detail section. Is there a
short cut to applying the formatting to all of them? If not, what's the
syntax to aplly to multiple controls?

fredg said:
In a report, I want only the first row of detail to have a "$" sign and all
subsequent detail records to be currency but no "$".

How can I do this?

First set the Format property of the control to:
$#,###.00

Next...
Add an unbound control to the detail section.
Set it's control source to
=1
Set it's Running sum to Over all
Name this control "RecCount"
You can make it not visible.

In the Detail Format event, code:
If [RecCount] >1 then
[YourControl].Format = "#,###.00"
End If
 
F

fredg

Hey Fred,

This worked however, I have 7 controls in the detail section. Is there a
short cut to applying the formatting to all of them? If not, what's the
syntax to aplly to multiple controls?

fredg said:
In a report, I want only the first row of detail to have a "$" sign and all
subsequent detail records to be currency but no "$".

How can I do this?

First set the Format property of the control to:
$#,###.00

Next...
Add an unbound control to the detail section.
Set it's control source to
=1
Set it's Running sum to Over all
Name this control "RecCount"
You can make it not visible.

In the Detail Format event, code:
If [RecCount] >1 then
[YourControl].Format = "#,###.00"
End If

For only 7 controls it's easiest just to list them each, one under the
other, in the code.

If [RecCount] >1 then
[YourControl1].Format = "#,###.00"
[YourControl2].Format = "#,###.00"
[YourControl3].Format = "#,###.00"
etc..
End If

If you had a whole bunch more, and they are all to be formatted the
same way, you could cycle through all the controls.

If [RecCount] > 1 Then
Dim c As Control
For Each c In Me.Section(0).Controls
If TypeOf c Is TextBox Then
c.Format = "#,###.00"
End If
Next
End If

By the way, depending upon what you have going on in the detail
section, it might be best to place this code in the detail print
event, not the format. Whatever works.
 
T

tw

In the Detail Format event, code:
If [RecCount] >1 then
[YourControl1].Format = "#,###.00"
[YourControl2].Format = "#,###.00"
[YourControl3].Format = "#,###.00"
[YourControl4].Format = "#,###.00"
[YourControl5].Format = "#,###.00"
[YourControl6].Format = "#,###.00"
[YourControl7].Format = "#,###.00"
End If

Bdavis said:
Hey Fred,

This worked however, I have 7 controls in the detail section. Is there a
short cut to applying the formatting to all of them? If not, what's the
syntax to aplly to multiple controls?

fredg said:
In a report, I want only the first row of detail to have a "$" sign and
all
subsequent detail records to be currency but no "$".

How can I do this?

First set the Format property of the control to:
$#,###.00

Next...
Add an unbound control to the detail section.
Set it's control source to
=1
Set it's Running sum to Over all
Name this control "RecCount"
You can make it not visible.

In the Detail Format event, code:
If [RecCount] >1 then
[YourControl].Format = "#,###.00"
End If
 
M

malherbe

t
tw said:
In the Detail Format event, code:
If [RecCount] >1 then
[YourControl1].Format = "#,###.00"
[YourControl2].Format = "#,###.00"
[YourControl3].Format = "#,###.00"
[YourControl4].Format = "#,###.00"
[YourControl5].Format = "#,###.00"
[YourControl6].Format = "#,###.00"
[YourControl7].Format = "#,###.00"
End If

Bdavis said:
Hey Fred,

This worked however, I have 7 controls in the detail section. Is there a
short cut to applying the formatting to all of them? If not, what's the
syntax to aplly to multiple controls?

fredg said:
On Wed, 6 Apr 2005 07:31:11 -0700, Bdavis wrote:

In a report, I want only the first row of detail to have a "$" sign
and all
subsequent detail records to be currency but no "$".

How can I do this?

First set the Format property of the control to:
$#,###.00

Next...
Add an unbound control to the detail section.
Set it's control source to
=1
Set it's Running sum to Over all
Name this control "RecCount"
You can make it not visible.

In the Detail Format event, code:
If [RecCount] >1 then
[YourControl].Format = "#,###.00"
End If
 
Top