Using SQL statement in VBA Access 2007
Posted on 2012-08-30
I am trying to pull records from a table in Access 2007. The script will run in VBA but only pull 1 record from the table using recordcount but there are two records in the table. When I run it as a regular query, which pull two records, and look at the SQL code generated it looks like this:
When I try to do the same in VBA using the following code, it only pulls 1 record.
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim sSQL As String
'Set the Data Access Object as the current db
Set db = CurrentDb
sSQL = "Select * from [tblLoginSecurity] where KerberosID = 'myname'"
If rs.RecordCount < 1 Then
**** This recordcount only shows 1 record.
Any idea on why it doesn't see the two records?