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.

LTD Social Sitings

Lessthandot twitter Lessthandot Linkedin Lessthandot facebook Lessthandot rss

Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.


From Wiki

Jump to: navigation, search

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.

Option Explicit

Dim WSHShell Dim fs, sPath, sPathTemp, sAccessPath, sKey

   Set fs = CreateObject("Scripting.FileSystemObject")
   If WScript.Arguments.Count > 0 Then
       sPath = WScript.Arguments.Item(0)
       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
      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

610 Rating: 2.5/5 (67 votes cast)