Sign in to follow this  
Followers 0
BigDaddyO

Retrieve Table Names From Access .mdb File

4 posts in this topic

Hello,

I am writing a little script where I need to do a LOT of searches in an Access .mdb file on all tables stored in that file. I have everything working great except I have had to hard code the Table names into the searches.

My issue is that the table names can very and the number of tables can very.

I need a way to retrieve all the table names that are in the file so I can use that for searching later on.

I have been searching google for 2 days and I haven't found anything, probably because I don't know the command to search for. :)

Any help is Greatly appreciated,

Mike


Share this post


Link to post
Share on other sites



YEA!!!!

Func _getTables($DBsource)
    $adoxConn = ObjCreate("ADOX.Catalog") 
    $adodbConn = ObjCreate("ADODB.Connection") 
    $adodbConn.open ("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $DBsource)
    $adoxConn.activeConnection = $adodbConn 
    for $table in $adoxConn.tables 
        if $table.type="TABLE" then 
            MsgBox(0, "Table", $table.name)
        endif 
    next 
    $adodbConn.close
    $adodbConn = ""
    $adoxConn = ""
EndFunc

God that was hard to find...

Mike


Share this post


Link to post
Share on other sites

YEA!!!!

Func _getTables($DBsource)
    $adoxConn = ObjCreate("ADOX.Catalog") 
    $adodbConn = ObjCreate("ADODB.Connection") 
    $adodbConn.open ("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $DBsource)
    $adoxConn.activeConnection = $adodbConn 
    for $table in $adoxConn.tables 
        if $table.type="TABLE" then 
            MsgBox(0, "Table", $table.name)
        endif 
    next 
    $adodbConn.close
    $adodbConn = ""
    $adoxConn = ""
EndFunc

God that was hard to find...

Mike

Thanks for sharing.

FYI SQL server has a sp_tables stored procedure that can be executed via ado to find this.

Share this post


Link to post
Share on other sites

I thought I remembered seeing also that there was an .mdb to .sql converter somewhere... (that may have been somewhere else though).


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0