Here's another approach, that you can simply insert into any standard module, and call from anywhere in the database. The first argument to the DCount function identifies the field you are counting, the second identifies the table, and the third (optional) states a criteria for limiting the records included in the count - in this case it is simply the name of a Boolean field.
Public Function PercentWhoBought () as Single
Dim Overall as Integer, Bought as Integer
Overall = DCount("bBoughtWidget", "tblResults")
Bought = DCount("bBoughtWidget", "tblResults", "bBoughtWidget")
If Overall > 0 Then
PercentWhoBought = Bought / Overall
Else
PercentWhoBought = 0
End If
End Function
[This message has been edited by AlanS (edited 08-14-2001).]
[This message has been edited by AlanS (edited 08-14-2001).]