title: Record count in Access table using VBA
body: <p>I'm trying to get the record count of a table, and if count is greater than 17, create a new table.</p>
  
  <pre><code>Dim rst As DAO.Recordset
  strSQL = "Select * from SKUS"
  Set rst = db.OpenRecordset(strSQL)
  
  If rst.RecordCount &gt; 17 Then
      Set tdf = db.CreateTableDef("161-0363")
  
      Set fld = tdf.CreateField("SKUS", dbText, 30)
      tdf.Fields.Append fld
  
      Set fld = tdf.CreateField("Count", dbInteger)
      tdf.Fields.Append fld
  
      db.TableDefs.Append tdf
  End If
  </code></pre>
  
  <p>This code doesn't create a new table, but when I change the if statement to this, it works:</p>
  
  <pre><code>...
  If rst.RecordCount &gt; 0 Then
      Set tdf = db.CreateTableDef("161-0363")
  ...
  </code></pre>
  
  <p>So the RecordCount is returning 1, I think. Why is this happening? I know for sure the table has 18 rows in it. <br>
  Can anyone help me out?</p>