Percentages of Pass/Fail fields in records

shakenama

Shakenama
Local time
Today, 07:18
Joined
Nov 13, 2007
Messages
6
I'm not sure whether this is better in a Query or in VB.

I have a Quality Assurance DB which has several agents listed. While monitoring I go down a specfic list in a form which contains Pass, Fail, or N/A combo boxes. This creates their QA record.
Each record has a total of 39 fields. Each field contains either a Pass, Fail, or N/A field. I'm trying to find the percentage of Passes in each record.

Could someone help me out with the problem?.. It would be much appreciated!

I know the answers probly very simple... but I'm fairly new with SQL
 
you'll have to manually calculate it over the fields. Sorry. Perhaps a better way to do it would be to call a function??
Code:
SELECT MYfunction([firstfield]) as MyPercentage
Code:
public function MYfunction(myString as string) as double

  dim fld as field, rs as recordset, x as integer, y as integer
    set rs = currentdb.openrecordset("TheTableName", dbopendynaset)

y = 0

with rs
  .findfirst "[fieldname] = '" & mystring & "'"
    for x = 1 to 39
      if fld(x) = "Pass" then
        y = y + 1
      end if
    next x
end with

MYfunction = y / 39
  rs.close

end function
This is just "pseudo code", as I believe they call it, but it could possibly work. The other alternative of course would be to change your data structure... ;)
 

Users who are viewing this thread

Back
Top Bottom