VBA code crashes after installing KB5064081 update

NikBab

New member
Local time
Today, 04:27
Joined
Sep 16, 2019
Messages
11
Hello,

After installing windows update KB5064081 on Windows 11 machine, the following piece of code crashes
on Access 2016:

Code:
Public Sub CreateTable(strPath As String)
Dim cat As ADOX.Catalog
Dim tbl As ADOX.Table
Dim idx As ADOX.Index
Dim flag As Boolean

Set cat = New ADOX.Catalog
cat.Create "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strPath

Set tbl = New ADOX.Table
With tbl
    .Name = "Products"
    .columns.Append "Id", adInteger
    .columns.Append "No", adInteger
    .columns.Append "Percentage", adSingle
    .columns.Append "Code", adVarWChar, 50
    Set .ParentCatalog = cat
    .columns("Id").Properties("Default") = 0
    .columns("No").Properties("Autoincrement") = True
    .columns("Percentage").Properties("Default") = 100
    .columns("Percentage").Properties("Nullable") = False
    .columns("Code").Properties("Jet OLEDB:Allow Zero Length") = False
End With
cat.Tables.Append tbl
Set tbl = Nothing

End Sub

The problem seems to occur due to the following lines:
Code:
 .columns("Id").Properties("Default") = 0
and
Code:
.columns("Percentage").Properties("Default") = 100

The event viewer reports the following error

event_viewer_crash.png


Are there any workarounds for this problem besides uninstalling KB5064081?

Thank you very much in advance!

Best Regards,
 
Last edited:
I have yet to install that, but what reference do I need for that ADOX ?
 
you can defer the Default part and add that Property using DDL SQL:
Code:
Public Sub CreateTable(strPath As String)
Dim cat As ADOX.Catalog
Dim tbl As ADOX.Table
Dim idx As ADOX.Index
Dim flag As Boolean

Set cat = New ADOX.Catalog
cat.Create "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strPath

Set tbl = New ADOX.Table
With tbl
    .Name = "Products"
    .Columns.Append "Id", adInteger
    .Columns.Append "No", adInteger
    .Columns.Append "Percentage", adSingle
    .Columns.Append "Code", adVarWChar, 50
    Set .ParentCatalog = cat

    'do not add default yet
    '.columns("Id").Properties("Default") = 0
    .Columns("No").Properties("Autoincrement") = True
    'do not add default yet
    '.columns("Percentage").Properties("Default") = 100
    .Columns("Percentage").Properties("Nullable") = False
    .Columns("Code").Properties("Jet OLEDB:Allow Zero Length") = False
End With
cat.Tables.Append tbl
Set tbl = Nothing


'now add the defaults

With CurrentProject.Connection
    .Execute "ALTER TABLE Products ALTER COLUMN Id SET DEFAULT 0"
    .Execute "ALTER TABLE Products ALTER COLUMN Percentage Set Default 100"
End With
    
End Sub
 
you can defer the Default part and add that Property using DDL SQL:
Code:
Public Sub CreateTable(strPath As String)
Dim cat As ADOX.Catalog
Dim tbl As ADOX.Table
Dim idx As ADOX.Index
Dim flag As Boolean

Set cat = New ADOX.Catalog
'cat.Create "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strPath
    Set cat.ActiveConnection = CurrentProject.Connection

Set tbl = New ADOX.Table
With tbl
    .Name = "Products"
    .Columns.Append "Id", adInteger
    .Columns.Append "No", adInteger
    .Columns.Append "Percentage", adSingle
    .Columns.Append "Code", adVarWChar, 50
    Set .ParentCatalog = cat
    'do not add default yet

    '.columns("Id").Properties("Default") = 0
    .Columns("No").Properties("Autoincrement") = True
   'do not add default yet

    '.columns("Percentage").Properties("Default") = 100
    .Columns("Percentage").Properties("Nullable") = False
    .Columns("Code").Properties("Jet OLEDB:Allow Zero Length") = False
End With
cat.Tables.Append tbl
Set tbl = Nothing


'now add the defaults

With CurrentProject.Connection
    .Execute "ALTER TABLE Products ALTER COLUMN Id SET DEFAULT 0"
    .Execute "ALTER TABLE Products ALTER COLUMN Percentage Set Default 100"
End With
      
End Sub


End Sub[/CODE]
Hello,

Same thing happens when using DDL for setting default values

Thank you very much for your suggestion!
 
i did not get any error using DDL SQL that i posted.
but i did get error using your code:

Code:
 .columns("Id").Properties("Default") = 0
 
Downloading now, going to be a while. :(

Edit: A very long while. Only at 6% now.
 
Last edited:
I installed all the references to try using A365 under Win10.
However I get a class not registered error on the provider code line.
1756827107910.png


I suspect this is due to having 64-bit Access and the drivers may still be 32-bit?
My memory of ADOX is that it is far less stable than either DAO or DDL
 
I installed all the references to try using A365 under Win10.
However I get a class not registered error on the provider code line.
View attachment 121381

I suspect this is due to having 64-bit Access and the drivers may still be 32-bit?
My memory of ADOX is that it is far less stable than either DAO or DDL
Unfortunately I cannot switch to DAO or DDL because the code that I posted is only part of
a rather large project and frankly I was hoping for a more general fix -if possible- without having to
perform extended changes to the code base

Thank you very much!
 
I don’t see why you can’t use DAO or DDL just for this one section of code even if you continue to use ADOX elsewhere.

Also try OLEDB.12.0 as already suggested in post #2
 
Since this seems to be a problem that occurred due to Windows update (particularly msjtes40.dll), is there a way to report it directly to Microsoft so that -hopefully :)- a fix could be released in future updates?
 
I'm about to ask another fellow MVP to test under Win 11 and if it is confirmed then one of us will report it.
Before I do so, please will you answer my questions from post #2
 
Looking at the post containing the crash details, the error code is 0xC0000005, which is a fatal memory management fault. The faulting module MSJTES40 is used by JET as an expression service related to query processing. It is part of a .DLL which will therefore be under MS's "cone of secrecy" regarding their code. Most of the time this specific error code represents EITHER a data reference to location 0 or a program jump/call to location 0. In this case, because we see the faulting address and it isn't 0, I'd rate the error as likely to be an illegal data reference to 0.

If you can debug that code by setting a break-point, I would look at the two references to Properties("Default") to see if they resolve correctly... i.e. do columns "Id" and "Percentage" have "Default" as predefined properies? A simple Debug.Print of Columns("Id").Properties("Default") will EITHER
(a) tell you a value - which is OK, doesn't matter what the value is, and it means my guess wasn't so good, OR
(b) will complain about it being undefined or null - in which case, that is the source of error 0xC0000005 right there. Which in turn means the solution is to define those properties ahead of time OR bypass any reference to them until the table is created, then add the properties and load them. Since I don't work with ADO any more, I'm too rusty to be sure.

Given the memory management error I would lean towards this being an invalid data reference to virtual location 0 because of something being undefined. Since you are using ADO to create a table and the fields in that table, you ARE creating stuff from vacuum, which means that some things you THINK should be created automatically perhaps are not so automatic as you thought. I'd ramble on further here, but I think the debug.print experiment is the next thing to try before we head down a rambling path to nowhere.

ArnelGP's comments also correctly focus in issues with the Default property. I think it is clear and a probable consensus as to the location of the error even if we aren't sure of WHY.
 
OK, I had to reboot my computer to get the update.
Access crashes for me as well. It creates the ID column then aborts.
First time I could not see the crash. Second time it crashed, but I had it in the event viewer. When I tried to open it, Access said I need to make a backup before the repair?

My references are
1756834046194.png

1756834070611.png


1756834361384.png

Now found the first crash.
1756834645210.png
 
Last edited:
Note that NikBab and Gasman report the same exception code 0xC0000005, fault offset 0x0001E150, time stamp 0x5EEF5084, and MSJTES40 version 10.0.26100.5074, but different versions of Access (16.0.4266.1003 vs 16.0.19029.20208). This suggests that the problem may well be independent of Access itself, that it is due to what is in the DLL code. This is of course subject to further investigation, but the fault appears to be at a consistent place in the faulting module. After the tests Colin mentioned, if there is consistency in the behavior, it would be appropriate to report this up to Microsoft.
When I tried to open it, Access said I need to make a backup before the repair?

Probably trying to tell you that Access crashed during something that created a structure - in this case a table - and so there is concern for a DB in an inconsistent state due to an incomplete operation. Typical for anything that crashes Access in mid-update.
 

Users who are viewing this thread

Back
Top Bottom