Local Table VS ODBC Tables

accessman2

Registered User.
Local time
Yesterday, 19:10
Joined
Sep 15, 2005
Messages
335
Hi,

I have a question. It's interesting.

In MS Access, I create local table, named table1, and use ODBC linked tables from SQL Server to MS Access, named tbl1.

Suppose I input 5 records in table1
I input 3 records in tbl1


Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("table1")
MsgBox rs.RecordCount

//it gives out 5. it is correct


Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("tbl1")
MsgBox rs.RecordCount

//it gives out 1. it is not correct

Does DAO support ODBC linked tables?

Thanks.
 
boblarson gave you an answer for that in another thread. The DAO .RecordCount will sometimes provide correct result, when there's few records, but to be sure, you'll need to "access" all the records first. This is done through issuing a .movelast on the recordset prior to fetching the recordcount. While the cursor is within the .Recordset keyword, hit F1, and read the help on DAO recordset.
 

Users who are viewing this thread

Back
Top Bottom