Calculated field vs module

H

hermie

Hello
On my report I have in the footer 4 fields. Field 1 and 2 are sum fields,
Field3 = field1/field2, Field 4 is a calfunction from a module.
When I calculate field 3 like: =round((field1/field2)*100) gives a value
like 68 and the calfunction of field4 generates a value of D
This is all good
Now I want to show the value as percent, when I change Field3 into
=field1/field2 with format percent it shows the correct value with % sign.
However Field4 generates a wrong value it shows an F instead of an D

Example:

value points Percent Nota
36 23 63.89 D
24 18 75.00 C
33 26 78.79 C
27 15 55.56 F
total 120 82 68 D
68% F

The code of the module is:
Public Function caltarea(Pertar As String) As String

Select Case CDbl(Pertar)
Case Is >= 90#
caltarea = "A"
Case Is >= 80# And Pertar < 90#
caltarea = "B"
Case Is >= 70# And Pertar < 80#
caltarea = "C"
Case Is >= 60# And Pertar < 70#
caltarea = "D"
Case Is < 60#
caltarea = "F"
Case Else
caltarea = "?"
End Select
End Function

I have tried to change field3 with Cdbl, Cstr but not work.

How can I show field3 as 68% and field 4 with D

How someone knows a solution

Herman
 
M

Marshall Barton

hermie said:
Hello
On my report I have in the footer 4 fields. Field 1 and 2 are sum fields,
Field3 = field1/field2, Field 4 is a calfunction from a module.
When I calculate field 3 like: =round((field1/field2)*100) gives a value
like 68 and the calfunction of field4 generates a value of D
This is all good
Now I want to show the value as percent, when I change Field3 into
=field1/field2 with format percent it shows the correct value with % sign.
However Field4 generates a wrong value it shows an F instead of an D

Example:

value points Percent Nota
36 23 63.89 D
24 18 75.00 C
33 26 78.79 C
27 15 55.56 F
total 120 82 68 D
68% F

The code of the module is:
Public Function caltarea(Pertar As String) As String

Select Case CDbl(Pertar)
Case Is >= 90#
caltarea = "A"
Case Is >= 80# And Pertar < 90#
caltarea = "B"
Case Is >= 70# And Pertar < 80#
caltarea = "C"
Case Is >= 60# And Pertar < 70#
caltarea = "D"
Case Is < 60#
caltarea = "F"
Case Else
caltarea = "?"
End Select
End Function

I have tried to change field3 with Cdbl, Cstr but not work.

How can I show field3 as 68% and field 4 with D


Multiply Pertar by 100 or change the Case statements to
check for .90, etc instead of 90, etc.
 
H

hermie

Marsh

I tried it out but both options you mentioned not works

Any other Idea?

Herman
 
H

hermie

Sorry I confused 2 fields but it works only need to change now some formulas
in my query

Thanx for your help

Herman
 

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

Similar Threads


Top