I currently use the VB6 CompactDatabase method to compact a .mdb (Access DB) file and have searched high and low for a way to reapply the Share Permissions on Original DB using VB6.
The CompactDatabase code:
Set jro = CreateObject("jro.JetEngine")
If IsObject(jro) Then
jro.CompactDatabase _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & sourcePath & _
";Jet OLEDB:Database Password=" & DBPassword, _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & tmpPath & _
";Jet OLEDB:Database Password=" & DBPassword & _
";Jet OLEDB:Encrypt Database=True;Jet OLEDB:Engine Type=5;"
Else
compactDB = "Compact Failed: MDAC not installed correctly - missing JRO.JETENGINE"
End If
This compacts to new DB and sequence is to Delete the original and rename new to old.
Problem with this is that new file does not have original Share Permissions, Currently set to 'Everyone' with 'Full Control'. I have found code on how to set permissions on folders but not directly to files.
Any help would be appreciated.