Ok, here is the wrap-up. After wiping and recreating the problem fields, I made a small HTA script that opens the database, waits a few seconds and closes it again. If the close attempt does not find the database, (presumably because it quit on its own, like it used to), the script announces an error and halts. I let it run for a couple of hours and got well over 400 successful starts out of it, and not one single crash.
At this point, I'm going to consider the problem solved. No idea what was wrong with those fields, and why they worked for so many years without problems, then suddenly started misbehaving in more modern machines, or why the problems persisted through multiple decompiles, C&Rs, and ports to new databases, but the details of exactly what went wrong are academic at this point. The database works, Microsoft has another black mark in my book for shitty quality control and life goes on.
Thank you everyone who contributed suggestions, and here is the HTA – maybe it will be useful to someone else who needs to exercise a start-up process.
Code:
<!DOCTYPE html><html lang="en">
<head>
<title>Database hammer</title>
<HTA:APPLICATION
APPLICATIONNAME = "Database hammer"
BORDER = "thick"
CAPTION = "yes"
SHOWINTASKBAR = "yes"
SINGLEINSTANCE = "no"
SYSMENU = "yes"
WINDOWSTATE="normal"
SCROLL = "no"
SCROLLFLAT = "no"
VERSION = "1.0"
INNERBORDER = "yes"
SELECTION = "yes"
MAXIMIZEBUTTON = "no"
MINIMIZEBUTTON = "no"
NAVIGABLE = "yes"
CONTEXTMENU = "yes"
BORDERSTYLE = "normal"
/>
</head>
<script language="VBScript">
Option Explicit
window.resizeTo 400,300
Sub StartHammer
dim i, t, k
t = now()
do
Process.value = "Started DB"
k = false
fred k
if k = false then
Process.value = "No Access"
exit sub
end if
Process.value = "Killed DB"
TimeElapsed.value = FormatDateTime(now()-t,3)
i = i + 1
Counter.value = cstr(i)
sleep 2
loop
End Sub
sub fred(k)
dim sh, objWMIService, colProcessList, objProcess, i, j
Set sh = CreateObject("WScript.Shell")
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2")
sh.run "D:\Paleontologie\ProductionNovy\Paleontologie.accdb"
sleep 15
Set colProcessList = objWMIService.ExecQuery("Select * from Win32_Process Where Name like '%access%'")
Process.value = "Starting kill " ' & cstr(j.value)
For Each objProcess in colProcessList
objProcess.Terminate()
k = true
Next
end sub
Sub sleep (Timesec)
dim sh
Set sh = CreateObject("WScript.Shell")
sh.Run "Timeout /T " & Timesec & " /nobreak" ,0 ,true
Set sh = Nothing
End Sub
</script>
<body style="background-color:mediumspringgreen;">
<h1>Database repeated start</h1>
<p>
<button onclick="StartHammer">Start hammer</button>
</p>
<p>
<label for="TimeElapsed">Process:</label>
<input type="text" value="Waiting to run" size="15" name="Process">
</p>
<p>
<label for="TimeElapsed">Run time:</label>
<input type="text" value="Time 0" size="20" id="TimeElapsed" name="TimeElapsed">
<p/>
<p>
<label for="Counter">Count of starts:</label>
<input type="text" value="No starts yet" size="15" id="Counter" name="Counter">
</p>
</body>
</html>