- ASP - Database Table Display
·Script Writers
·Database Display
·Response Objects
·Server Variables
·Random Events
·What's New?
Mail List


Summarizing a Yes/No Field
One of the possible data types that can be used in Access is a Yes/No data type.  This will allow for input of a simple yes (True) or a no (False).  Summarizing this data type is not done in the same manner as summarizing a numeric value.  The following example will read all the values from an Yes/No field in Access and count the the number of True or False responses and output the totals for each, the total number of observations, as well as the percent of True and False to the total.
View the Output
Text View
Print View
Mail this Link
Download the Code
View the Data

'Query the table for all responses
cn="DRIVER={Microsoft Access Driver (*.mdb)};"
cn=cn & "DBQ=" & server.mappath(accessdb)
set rs = server.createobject("ADODB.Recordset")
sql = "select * from [table]" sql, cn

'move to the first record

'starts a loop that will continue until
'there are no more records
do while not rs.eof

'Check the value of the Yes/No field.
'ans_true and ans_false will accumulate
'a numeric summerization of the values contained
'in the table field

if rs("field") = "True" then
end if

if rs("field") = "False" then
end if


'Output the stats

True: <%= ans_true %> <br>
False: <%= ans_false %> <br>
Total: <%= ans_true + ans_false %> <br>
%True: <%= formatnumber(ans_true/(ans_true + ans_false),2) %> <br>
%False <%= formatnumber(ans_false/(ans_true + ans_false),2) %>




ASP: What's New? | Articles | Script Writers | Database Display | Read/Write
Server Variables | Response Objects | Random Events | Miscellaneous
HTML: Forms | Hyperlinks | Headers | Tables | Hyperlinks | Headers | Text Display
JavaScript: Document Info | Forms | Images | Navigation | Script Writers
CSS: Basics | Page Display | Text Display | Script Writers | Miscellaneous
  • 2014 michael kors
  • air max women 2013
  • 2014 michael kors
  • air max 2014
  • oakley glasses
  • oakley glasses

  • Maps: Map Script Writers | Bing Maps | Google Maps
  • bottes fr
  • ugg boot
  • Privacy Statement is hosted by
    Donate Food Online with a Mouse Click at
    Donate Land Online with a Mouse Click at
    © 1999 - 2018
    All Rights Reserved

  • Kids jordan 6 rings
  • Jordan retro 10
  • Jordan retro 3