title: count the number of rows in sql query result using access vba
body: <p>I am trying to  count the number of rows in sql query result using access 2007 vba. 
  What I have is a text box named <code>AGN</code> when a user put value on it check for this value then it bring back <code>MsgBox</code> if the the value is already inserted.   What I try to do is : </p>
  
  <pre><code>Dim rs As DAO.Recordset
   Dim db As Database
    Dim strSQL As String
  
    Set db = CurrentDb
  
   strSQL = "SELECT agencies.[agency no] FROM agencies WHERE agencies.[agency no]= " &amp;Me.AGN.Text
  
    Set rs = db.OpenRecordset(strSQL)
  
  If rs.Fields.Count &gt; 1 Then
  
  
  MsgBox "this value is already here "
  
    End If
  
     Set rs = Nothing   
  </code></pre>
  
  <p>When I insert any value on the textbox I got run time error 3061 (too few parameters)</p>