I am trying to get a percentage of how many products have been counted by using SQL statements. I have one that returns how many have been counted (checked) and another for how many have not been counted (needToCheck). I get a datatypoe mismatch when I try to equate the long variables to the connection execution. I was wondering if any knew how I could get the numbers I want easily rather than looping through the table twice. I would like to just be able to divide checked by needToCheck and multiply by 100 and output it to a label to let people know how far along they have come. Any suggestions? Thank you.

VB Code:
  1. Private Sub completed()
  2.     Dim checked As Long
  3.     Dim needToCheck As Long
  4.     Dim sql As String
  5.    
  6.     Set connection = New ADODB.connection
  7.     connection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
  8.         "Data Source= G:\Finance\Inventory Control\CycleCount\DB\cycleCount.mdb"
  9.     connection.Open
  10.    
  11.     sql = "SELECT Count(PROD) AS Expr1 " & _
  12.               "From TOGO " & _
  13.               "WHERE (((TOGO.CHECKED)=TRUE));"
  14.    
  15.     checked = connection.Execute(sql)
  16.    
  17.     sql = "SELECT Count(PROD) AS Expr1 " & _
  18.               "From TOGO " & _
  19.               "WHERE (((TOGO.CHECKED)=FALSE));"
  20.  
  21.     needstoCheck = connection.Execute(sql)
  22. End Sub