Conditional Decimal formatting in reports


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.
 
Ad

Advertisements

M

Marshall Barton

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.
 

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