I am trying to speed up a long running process in a clients Access 2013 application by among other things, changing the open of the recordsets involved in the process from
1. rsIn.Open selectString, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
2. rsIn.Open selectString, CurrentProject.Connection, adOpenForwardOnly, adLockReadOnly
When I was using 1. I could check the number of records in the result set with wkTotRecs = rsIn.RecordCount
I then put a counter on the screen showing the total number of records and which records was being processed.
'Processing 23 of 125'
I find this to be much more meaningful to the users that the status bar.
When I open with 2., rsin.Recordcount always is -1.
Is there an efficient way to get the number of records in the result set while using format 2.?
I know I could do a count() but that seems like it would be processing the file twice. One to get the count and one to read the records. Dcount would also work but that would also increase the overhead, which I am trying to reduce.
I think adCursorLocation can accomplish this but I'm not sure how to set it.