I found a more elegant way of doing it than both of these. You can add SaveChanges:=False
to the .Close
statement and it releases without prompting.
Anyway. Cooking with gas now, got the thing doing mostly what I want, and hooked it into an event handler so it automatically fires the script when the key field is updated. Chuffed with that.
The only major glitch I’ve got outstanding is that the data file is accessed via a UNC pathname which is actually a Sharepoint server. On some clients, the users are prompted for their Windows credentials if they open the data file manually via Sharepoint. On those clients, the script fails. If they open the file, supply credentials and then close it again, it caches the credentials and everything works again. This seems to be a bug / configuration error on some PCs and I can’t readily work out how to get it to prompt for credentials. Hmm.