BigDaddyO Posted March 21, 2006 Posted March 21, 2006 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
BigDaddyO Posted March 21, 2006 Author Posted March 21, 2006 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
billmez Posted March 21, 2006 Posted March 21, 2006 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.
Moderators SmOke_N Posted March 21, 2006 Moderators Posted March 21, 2006 I thought I remembered seeing also that there was an .mdb to .sql converter somewhere... (that may have been somewhere else though). 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now