You've commented out this line:
' MsgBox "RecCount = " & RecCount
What happens if you replace it with
MsgBox "RecCount = " rst.RecordCount
before attempting to assign that recordcount to the variable.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
After recently upgrading from Office 2010 to Office 2021, a report fails with a type mismatch error. I've made no changes to the code, and it still works in Access 2010. In addition to the code below, RecCount is declared Public Integer.
The references are: Visual Basic For Applications; Microsoft Access 16.0 Object Library; OLE Automation; Microsoft Outlook 16.0 Library; Microsoft ActiveX Data Objects 2.1 Library.
Any suggestions would be greatly apreciated.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
You've commented out this line:
' MsgBox "RecCount = " & RecCount
What happens if you replace it with
MsgBox "RecCount = " rst.RecordCount
before attempting to assign that recordcount to the variable.
Same problem.
It's erroring on the RecCount = rstRec.RecordCount statement.
So that appears to confirm that the problem is in the properties of the ado recordset in the current version of Access. There was a recent bug that might be related to this. I have to track it down, though, as it's been a few days and I don't have the reference at hand. While I search, perhaps someone will recall the bug.
Do yiou have Option Explicit set? Where do you Dim RecCount?
At the beginning of the module.
Option Compare Database
Option Explicit
Public NxtPgNum, RecCount As Integer, MlgRate As Currency