Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Reports / Printing / October 2004

Tip: Looking for answers? Try searching our database.

Calculated field vs module

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
hermie - 14 Oct 2004 17:06 GMT
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
Marshall Barton - 14 Oct 2004 17:43 GMT
>Hello
>On my report I have in the footer 4 fields. Field 1 and 2 are sum fields,
[quoted text clipped - 38 lines]
>
>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.

Signature

Marsh
MVP [MS Access]

hermie - 14 Oct 2004 17:48 GMT
Marsh

I tried it out but both options you mentioned not works

Any other Idea?

Herman

> >Hello
> >On my report I have in the footer 4 fields. Field 1 and 2 are sum fields,
[quoted text clipped - 41 lines]
> Multiply Pertar by 100 or change the Case statements to
> check for .90, etc instead of 90, etc.
hermie - 14 Oct 2004 17:54 GMT
Sorry I confused 2 fields but it works only need to change now some formulas
in my query

Thanx for your help

Herman

> >Hello
> >On my report I have in the footer 4 fields. Field 1 and 2 are sum fields,
[quoted text clipped - 41 lines]
> Multiply Pertar by 100 or change the Case statements to
> check for .90, etc instead of 90, etc.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.