Alex Gordon
Alex Gordon

Reputation: 60871

opening an mdb access file without access

i dont have microsoft access but would like to open an mdb file, is there any way to do this?

the mdb file contains SQL code that i need. it is just a file that connects to a remote database. i need to view the sql code

i did try openoffice base, but it only showed me some tables. i dont see where the sql code is?

Upvotes: 2

Views: 3112

Answers (5)

HansUp
HansUp

Reputation: 97131

This VBScript will print out the SQL statements from the saved queries in your MDB database.

Option Explicit
Dim dbe
Dim db
Dim qdf

Set dbe = CreateObject("DAO.DBEngine.36")
'change the next line to include the full path to your database
Set db = dbe.OpenDatabase("C:\SomeFolder\YourDatabase.mdb")
For Each qdf In db.QueryDefs
    If Left(qdf.Name,1) <> "~" Then
        Wscript.StdOut.WriteLine qdf.Name
        Wscript.StdOut.WriteLine qdf.SQL
        Wscript.StdOut.WriteLine String(20, "-")
    End If
Next
Set db = Nothing
Set dbe = Nothing

I saved it as DumpQuerySQL.vbs, then ran it from a command prompt like this:

cscript DumpQuerySQL.vbs > querySQL.txt

Upvotes: 5

Peter Turner
Peter Turner

Reputation: 11435

Have you tried openoffice base? I've had good luck with that converting MDB files.

Upvotes: 0

Johannes Rudolph
Johannes Rudolph

Reputation: 35761

visual studio is able to view and modify access databases via its datasources features.

You might also want to check out FlySpeed SQL Query, which can query all kinds of databases "on the fly"

Upvotes: 1

David
David

Reputation: 25470

The Jet driver included with most versions of Windows can do this. You can use the Jet driver through your prefered provider or API (ODBC, ADO, ADO.NET). Even Excel supports it (Open file, and choose MDB).

Upvotes: 1

Daniel Elliott
Daniel Elliott

Reputation: 22887

"Accessing" it through ADO.NET and virtually anything else should do the trick.

Kindness,

Dan

Upvotes: 2

Related Questions