0

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!

1
  • 1
    In what way are you able to tell that rst=nothing? Throw in MsgBox rst.RecordCount just after your rst.MoveFirst and see what you get. Because I copy and pasted your code, replace the name with one of my tables and it worked fine. Commented May 22, 2015 at 15:59

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

I was apparently over the limit for the recordset despite the table being OK.... Thanks for the help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.