title: EOF and BOF error when querying SQL database
body: <p>I'm trying to query a SQL database from vbs but when no record is found I get an error </p>
  
  <blockquote>
    <p>ADODB.Field : Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.</p>
  </blockquote>
  
  <p>I think I need to use an IF NOT statement to capture if the record isn't found but I can't figure out where it needs to go. </p>
  
  <pre><code>Do Until objFile.AtEndofStream
      strAppName = objFile.ReadLine
  
      ConnString="DRIVER={SQL Server};SERVER=aardvark002;UID=***;PWD=***;DATABASE=DEW_Users"
      SQL = "USE Win7AppData SELECT " &amp; Chr(34) &amp; strCountry &amp; Chr(34) &amp; " FROM AppsByCountry WHERE Application = '" &amp; strAppName &amp; "'"
  
      Set Connection = CreateObject("ADODB.Connection")
      Set Recordset = CreateObject("ADODB.Recordset")
      Connection.Open ConnString
      Recordset.Open SQL,Connection
      strApproval = Recordset(strCountry)
      If StrApproval = "YES" Then
          strApproval = "Approved"
      Else
          strApproval = "Denied"
      End If
      objExcel.Cells(intRow, 1).Value = strAppname 
      objExcel.Cells(intRow, 2).Value = strCountry
      objExcel.Cells(intRow, 3).Value = strApproval
      intRow = intRow + 1
  Loop
  </code></pre>