What is wrong with this DAO connection to the current DB?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello, I'm using Access 2002. Can someone please look at this code and tell me why it doesn't retrieve any rows from the table and show the correction(s) to make it work?

It seems to connect, but the recordset doesn't retrieve any rows (the table has 522 rows)

Dim db As DAO.Databas
Dim rs As DAO.Recordse
Dim strSQL As Strin
Dim lngRows As Lon
Dim lngCols As Lon

strSQL = "SELECT * FROM [TempTable1];

Set db = CurrentD
Set rs = db.OpenRecordset(strSQL

lngRows = rs.RecordCount -
lngCols = rs.Fields.Count -

MsgBox lngRows & " X " & lngCol

rs.Clos
db.Clos
Set rs = Nothin
Set db = Nothin

Thanks much in advance for the assistance.
 
rotor said:
Hello, I'm using Access 2002. Can someone please look at this code and
tell me why it doesn't retrieve any rows from the table and show the
correction(s) to make it work?
It seems to connect, but the recordset doesn't retrieve any rows (the
table has 522 rows):

RecordCount is not accurate unless you do a MoveLast first. Prior to that
it only indicates the records accessed so far.
 
Back
Top