Conditional Decimal formatting in reports

  • Thread starter Thread starter freddiso
  • Start date Start date
F

freddiso

I have a simple report with data grouped by accounttype such as Sales,
PercentRate. I would like my detail records to have no decimal points
for the Sales and 4 decimal points for the PercentRate. How do I go
about doing this? I'm guessing it has to do with On Format but how do
I construct the expression? Thanks.
 
I have a simple report with data grouped by accounttype such as Sales,
PercentRate. I would like my detail records to have no decimal points
for the Sales and 4 decimal points for the PercentRate. How do I go
about doing this?


If the format is based on the group, then you can use the
group header sections Print event to change the detail text
box's Format property:
Select Case Me.accounttype
Case "Sales"
Me.[detail text box].Format = "0"
Case "PercentRate"
Me.[detail text box].Format = "0.0000"
Case Else
Me.[detail text box].Format = "General"
End Sekect

But I am uncomfortable using data values such as "Sales" in
a VBA procedure. Maybe you should have a format type field
in the table and use that instead.

If the format can be different in each detail record
regardless of grouping, then use the detail section's Format
event with similar code.
 
Back
Top