Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.
If you run into odd happenings in your code, and before distribution, decompiling is a good idea. As well as correcting a number of problems, decompile saves space and improves speed. I find the most convenient way to do this is with a little VBScript. You can copy the code below to a text file, with a .vbs extension, and simply drop the mdb to be decompiled onto the file. Decompile is a start-up switch, so this code will open your mdb and ask for a password, if one is required.
Dim WSHShell Dim fs, sPath, sPathTemp, sAccessPath, sKey
Set fs = CreateObject("Scripting.FileSystemObject") If WScript.Arguments.Count > 0 Then sPath = WScript.Arguments.Item(0) Else sPathTemp = Left(WScript.ScriptFullname, _ InStrRev(WScript.ScriptFullname, "\")) sPath = InputBox("Enter Path and Name of .mdb", "Decompile", sPathTemp) End If If sPath = "" Or fs.FileExists(sPath) = False Then _ Or Right(sPath, 4) <> ".mdb" MsgBox "Not a valid file: " & vbCrLf & sPath, 64, "Decompile" '64=vbInformation Else Set WSHShell = CreateObject("WScript.Shell") sKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\MSACCESS.EXE\" sAccessPath = WSHShell.RegRead(sKey) WSHShell.Run Chr(34) & sAccessPath & Chr(34) & " " & Chr(34) & sPath & Chr(34) & " /decompile" End If