Is the VBA 64 bit compiler broken?

Ian Vale 1 Reputation point
2021-07-06T08:25:21.613+00:00

Please bear with me, this 'bug' is not easy to explain and due to its complexity and the confidentiality of the code where I've 'found' it, I can't post a sample that someone could run.

I have been building a complex task scheduler and downloader for SAP data in MS Access for my employer. It works fine in 32 bit Access, and works in 64 bit Access when the code is stepped through, but there are a couple of places where my code causes Access to crash when allowed to run normally in 64 bit Access.

Careful examination using stop lines narrowed down the problem. The lines causing the crashes seem to relate to the 'For Each x in y' line where a collection of objects is going to be looped through. My collections are custom written classes, and I use a similar structure for them all, one for the collection itself, and one for the items that are within the collections.

The crash happens with different collection/item classes, not just the same one. But what's really weird is that not every 'For Each' call on the same collection/item causes a crash, there are earlier calls where they work fine.

It 'smells' like there's something wrong with the compiler for 64 bit, perhaps reaching some kind of limit at those points in the code where the crash happens.

I'm also thinking that because the code works when stepped through, that Access is holding two different versions of the VBA - one in uncompiled text form, and one in compiled form.

The fact that the exact same code works in 32 bit and compiles and runs in step through in 64 bit, tells me this isn't an error in the way I'm writing either my 32 bit or my 64 bit code. I've got plenty of code that works fine in 64 bit, and as I've already said those exact collections work OK at other points in the code before the places where the 'For Each' lines cause a crash.

Apologies for not having any example to post, but as I've said the code is for my employer, it doesn't belong to me and it is under a confidentiality clause. Also, the actual code requires a set up that uses SAP as well, so it would be practically impossible to post a sample that someone could actually test.

Access Development
Access Development
Access: A family of Microsoft relational database management systems designed for ease of use.Development: The process of researching, productizing, and refining new or existing technologies.
830 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Daniel Pineault 431 Reputation points MVP
    2021-07-06T11:08:39.327+00:00

    Without code it is going to be impossible to say what is going on here. My advice would be to use the Feedback button within Access to provided this information directly to the Access Dev Team in the hopes they engage with you further on the subject. Also, be sure to include you email address, otherwise they won't be able to followup with you should they wish to do so


  2. Ian Vale 1 Reputation point
    2021-09-09T08:43:35.433+00:00

    This post on stack overflow might just be about the same thing:

    https://stackoverflow.com/questions/63848617/bug-with-for-each-enumeration-on-x64-custom-classes

    I haven't tested any fixes suggested by the post as yet, but it sounds very similar, even down to the step through code working.

    0 comments No comments