Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 24th, 2006, 05:16 AM
Authorized User
 
Join Date: Nov 2005
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default VB code in Report Modified

I have a report with four fields; NAME,HIV,HBV,HCV,RPR. Apart from the NAME the others represent diseases. In this report each person represented by the NAME would tested for the four (4) disease markers. The result is indicated by either 1 which represents a negative result or 2 which represents a positive result. therefore, if an individual is negative in all the disease markers and another one is say positive for HIV, the report will appear like this;
NAME HIV HBV HCV RPR
Ben 1 1 1 1
Jane 2 2 1 1
Sila 1 2 2 1
etc
Now the task is to calculate the disease prevalence for each disease marker which has tested positive or has 2 indicated. the general formular is e.g for HIV the number of persons tested positive for HIV Divided by the total number of persons tested Multiplied by 100 to get percentage. according to our table one person tested positive to HIV out of the Three. therefore
HIV = 1/3 x 100 = 33%
HBV = 2/3 x 100 = 66%
HCV = 1/3 x 100 = 33%
RPR = 0 = 0%
The above calculations will show the disease prevalence and need to be displayed on the report .
How can I compute the above calculations using VBA Code in the report?
The report gets its values from two other tables the first where the individual results are entered and another where the names and person's IDs are entered
Help?
Bright


Bmulenga

Bmulenga
__________________
Bmulenga
 
Old November 24th, 2006, 06:02 AM
Authorized User
 
Join Date: Jan 2006
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi bright,
am assuming the following fields exist
1.name of persons
2.disease category-hiv,hbv,e:t:c
3.prevalence rate-2,1, e:t:c

now,lets go on
the report will have 2 report group levels
1.total prevelence rate for all diseases(this will be the first report level).the report group levels must have both a report header and footer.
this will be queried as follow
field(count[prevalence rate]) as footer-assume its(total prevalence rate)
2.prevalence rate for each disease category

this will be queried as follow
field(disease category)which will be grouped
field(total:count([disease prevalence])-this will count each prevalence rate by each category)
field ([disease prevalence]/100)*([total prevelence rate]) used in the first report generational level.

in using this method,i have assumed that

1.u are farmiliar with access report wizards
2.u are farmiliar with access query.

bye for now.

u acn also search the internet for books on access.







Similar Threads
Thread Thread Starter Forum Replies Last Post
assign report permissions thru vb .net code polofson Reporting Services 0 April 15th, 2008 05:31 PM
JSP Cannot save Modified Code Q4Java JSP Basics 3 September 15th, 2007 01:27 AM
VB code in Report bright_mulenga Access 3 November 27th, 2006 09:00 AM
the crystal report can not be modified again ligi Crystal Reports 3 October 9th, 2004 11:39 PM
Changing Crystal Report Title from VB Code Niaz Pro VB Databases 4 June 9th, 2004 09:51 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.