user2950162
user2950162

Reputation: 1011

access vba code returns empty recordset despite table having records

I have this code in VBA but its returning an empty recordset...

Sub total_disc()


Dim dbs As DAO.Database
Dim rst As DAO.Recordset


Set rst = CurrentDb.OpenRecordset("pre_pl")

rst.MoveFirst

Where pre_pl is a table with more than a million records. Despite that I am getting rst = nothing.

Any ideas what am I missing?

Thanks!

Upvotes: 0

Views: 308

Answers (1)

Gene
Gene

Reputation: 392

You might want to check the size of the table. The limit on table in Access is 2GB, while the limit for a recordset is only 1GB. if you have millions of records, and a lot of data in each record you might be over the limit of a recordset, but not the table. Try creating a query to limit your data to narrower search and see if it works then.

Access Limits can be found here: https://support.office.com/en-za/article/Access-2010-specifications-1e521481-7f9a-46f7-8ed9-ea9dff1fa854#__toc296343505

Upvotes: 1

Related Questions