MS Access VBA Application Won't Compile When Moved to Windows 11

njl100 41 Reputation points
2024-11-23T14:51:35.0333333+00:00

Hi, I've got an Access/VBA application that I've been developing over many years. I've just upgraded my computer moving from Win 10 Home to Win 11 Pro. When I come to compile the application it is failing. I've checked all the References on the new computer and they all seem to be present.

The error I get is Type Mismatch on the following line of code

lngRecordCount = .RecordCount

where .RecordCount is a property of an ADODB Recordset.

lngRecordCount is declared as a Long Integer at module level. The same code compiles fine on the Win 10 machine.

Please can someone advise on what is happening.

TIA

Nigel

Microsoft 365 and Office | Access | For business | Windows
{count} votes

1 answer

Sort by: Most helpful
  1. njl100 41 Reputation points
    2024-11-23T17:27:39.34+00:00

    I did what you suggested and the same problem happened once I'd loaded the ActiveX Data Objects reference into the project. This was an old version (2.1). When I replaced it with latest version (6.0) it compiled. I did the same on my application and it also compiled. So that seems to have solved the problem.

    Thanks for your help.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.