{"id":6417,"date":"2017-10-11T06:48:22","date_gmt":"2017-10-10T21:48:22","guid":{"rendered":"http:\/\/excelwork.info\/excel\/?p=6417"},"modified":"2017-10-11T06:48:22","modified_gmt":"2017-10-10T21:48:22","slug":"adoxgettablequery","status":"publish","type":"post","link":"https:\/\/excelwork.info\/excel\/adoxgettablequery\/","title":{"rendered":"\u30c6\u30fc\u30d6\u30eb\u540d\u3001\u30af\u30a8\u30ea\u540d\u306e\u53d6\u5f97\uff08ADOX\uff09"},"content":{"rendered":"<h2>\u30c6\u30fc\u30d6\u30eb\u540d\u306e\u53d6\u5f97<\/h2>\n<div class=\"m30-l\">\n<h3 id=\"adox_table_type\">Table.Type \u30d7\u30ed\u30d1\u30c6\u30a3<\/h3>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <span class=\"red\"><strong>\uff1c\u53d6\u5f97\uff1e<\/strong><\/span><br \/>\n    <em>object<\/em>.<strong>Type<\/strong><\/p><\/div>\n<br \/>\n<h4>\u5f15\u6570\u30fb\u623b\u308a\u5024<\/h4>\n<div class=\"m30-l\">\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>object&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5bfe\u8c61\u3068\u306a\u308b <span class=\"red\"><strong>Table \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong><\/span>\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>\u623b\u308a\u5024&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u30c6\u30fc\u30d6\u30eb\u306e\u7a2e\u985e\u3092\u8868\u3059\u6587\u5b57\u5217\u578b\uff08String\uff09\u306e\u5024\u3092\u8fd4\u3057\u307e\u3059\u3002<br \/>\n<table>\n<tr>\n<td align = \"center\" width=\"250\" bgcolor=\"#ffffccc\"><strong>\u623b\u308a\u5024<\/strong><\/td>\n<td align = \"center\" width=\"400\" bgcolor=\"#ffffccc\"><strong>\u30c6\u30fc\u30d6\u30eb\u306e\u7a2e\u985e<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"250\">TABLE<\/td>\n<td width=\"400\">\u901a\u5e38\u306e\u30c6\u30fc\u30d6\u30eb<\/td>\n<\/tr>\n<tr>\n<td width=\"250\">VIEW<\/td>\n<td width=\"400\">\u30d1\u30e9\u30e1\u30fc\u30bf\u306a\u3057\u306e\u9078\u629e\u30af\u30a8\u30ea<\/td>\n<\/tr>\n<tr>\n<td width=\"250\">LINK<\/td>\n<td width=\"400\">\u30ea\u30f3\u30af\u30c6\u30fc\u30d6\u30eb\uff08ODBC\u4ee5\u5916\uff09<\/td>\n<\/tr>\n<tr>\n<td width=\"250\">ACCESS TABLE<\/td>\n<td width=\"400\">Access \u30b7\u30b9\u30c6\u30e0\u30c6\u30fc\u30d6\u30eb<\/td>\n<\/tr>\n<tr>\n<td width=\"250\">SYSTEM TABLE<\/td>\n<td width=\"400\">Microsoft jet \u30b7\u30b9\u30c6\u30e0\u30c6\u30fc\u30d6\u30eb<\/td>\n<\/tr>\n<tr>\n<td width=\"250\">PASS-THROUGH<\/td>\n<td width=\"400\">\u30ea\u30f3\u30af\u30c6\u30fc\u30d6\u30eb\uff08ODBC\uff09<\/td>\n<\/tr>\n<\/table>\n<p>\n      <\/li>\n<\/ul><\/div>\n<br \/><br \/>\n<h3 id=\"adox_catalog_view\">Catalog.Views \u30b3\u30ec\u30af\u30b7\u30e7\u30f3<\/h3>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <em>object<\/em>.<strong>Views<\/strong><\/p><\/div>\n<br \/>\n<h4>\u5f15\u6570\u30fb\u623b\u308a\u5024<\/h4>\n<div class=\"m30-l\">\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>object&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5bfe\u8c61\u3068\u306a\u308b <span class=\"red\"><strong>Catalog \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong><\/span>\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n<br \/>\n<p class=\"caution4\"><strong>Views \u30b3\u30ec\u30af\u30b7\u30e7\u30f3<\/strong>\u3067\u306f\u3001<strong>\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u542b\u307e\u306a\u3044\u9078\u629e\u30af\u30a8\u30ea<\/strong>\u3092\u7ba1\u7406\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<\/p><\/div>\n<br \/><br \/>\n<h3 id=\"adox_catalog_procedures\">Catalog.Procedures \u30b3\u30ec\u30af\u30b7\u30e7\u30f3<\/h3>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <em>object<\/em>.<strong>Columns<\/strong><\/p>\n<p>    <em>object<\/em>.<strong>Procedures<\/strong><\/p><\/div>\n<br \/>\n<h4>\u5f15\u6570\u30fb\u623b\u308a\u5024<\/h4>\n<div class=\"m30-l\">\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>object&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5bfe\u8c61\u3068\u306a\u308b <span class=\"red\"><strong>Catalog \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong><\/span>\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n<br \/>\n<p class=\"caution4\"><strong>Procedures \u30b3\u30ec\u30af\u30b7\u30e7\u30f3<\/strong>\u3067\u306f\u3001<strong>\u30a2\u30af\u30b7\u30e7\u30f3\u30af\u30a8\u30ea\u3084\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u542b\u3080\u9078\u629e\u30af\u30a8\u30ea<\/strong>\u3092\u7ba1\u7406\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<\/p><\/div>\n<\/div>\n<br \/><br \/>\n<h2>ADOX \u3067\u3001\u30c6\u30fc\u30d6\u30eb\u540d\u30fb\u30af\u30a8\u30ea\u540d\u3092\u53d6\u5f97\u3059\u308b\u4f8b<\/h2>\n<div class=\"m30-l\">\n<br \/>\n<h3 id=\"vba_sample\">\u30b5\u30f3\u30d7\u30ebVBA\u30bd\u30fc\u30b9<\/h3>\n<pre class=\"lang:vb mark:0 decode:true \" title=\"\u30c6\u30fc\u30d6\u30eb\u540d\u30fb\u30af\u30a8\u30ea\u540d\u53d6\u5f97\" data-url=\"http:\/\/example.co.jp\" >\r\n\u3000\r\nSub Sample_ADOX_tablequery()\r\n\r\n    '\u53c2\u7167\u8a2d\u5b9a:Microsoft ActiveX Data Objects 6.1 Library\r\n    '\u53c2\u7167\u8a2d\u5b9a:Microsoft ADO Ext.6.0 for DDL and Security\r\n                    \r\n    Dim cat As ADOX.Catalog\r\n    Dim tbl As ADOX.Table\r\n    Dim qry1 As ADOX.View\r\n    Dim qry2 As ADOX.Procedure\r\n    Dim constr As String\r\n    Dim DBFile As String\r\n    Dim strTbl(1 To 6) As String\r\n    Dim strQry(1 To 2) As String\r\n    Dim msg1 As String\r\n    Dim msg2 As Variant\r\n    \r\n    On Error GoTo ErrHandler\r\n    \r\n    '\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30d1\u30b9\u3068\u540d\u524d\r\n    \r\n    'Access 2007\u4ee5\u964d\uff08accdb \u30d5\u30a1\u30a4\u30eb\uff09\r\n    DBFile = ActiveWorkbook.Path & \"\\mydb3.accdb\"\r\n    constr = \"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\" & DBFile\r\n    \r\n    'Access 2003\u4ee5\u524d\uff08mdb \u30d5\u30a1\u30a4\u30eb\uff09\r\n    'DBFile = ActiveWorkbook.Path & \"\\mydb2.mdb\"\r\n    'ConStr = \"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\" & DBFile\r\n    \r\n    Set cat = New ADOX.Catalog\r\n    cat.ActiveConnection = constr\r\n    \r\n    '\u30c6\u30fc\u30d6\u30eb\r\n    For Each tbl In cat.Tables\r\n        Select Case tbl.Type\r\n            Case \"TABLE\"\r\n                If strTbl(1) = \"\" Then strTbl(1) = \"\u3010\u30c6\u30fc\u30d6\u30eb\u3011\"\r\n                strTbl(1) = strTbl(1) & vbCrLf & \" \" & tbl.Name\r\n            Case \"VIEW\"\r\n                If strTbl(2) = \"\" Then strTbl(2) = \"\u3010\u9078\u629e\u30af\u30a8\u30ea\uff08\u30d1\u30e9\u30e1\u30fc\u30bf\u306a\u3057\uff09\u3011\"\r\n                strTbl(2) = strTbl(2) & vbCrLf & \" \" & tbl.Name\r\n            Case \"LINK\"\r\n                If strTbl(3) = \"\" Then strTbl(3) = \"\u3010\u30ea\u30f3\u30af\u30c6\u30fc\u30d6\u30eb\uff08ODBC\u4ee5\u5916\uff09\u3011\"\r\n                strTbl(3) = strTbl(3) & vbCrLf & \" \" & tbl.Name\r\n            Case \"ACCESS TABLE\"\r\n                If strTbl(4) = \"\" Then strTbl(4) = \"\u3010Access \u30b7\u30b9\u30c6\u30e0\u30c6\u30fc\u30d6\u30eb\u3011\"\r\n                strTbl(4) = strTbl(4) & vbCrLf & \" \" & tbl.Name\r\n            Case \"SYSTEM TABLE\"\r\n                If strTbl(5) = \"\" Then strTbl(5) = \"\u3010Microsoft jet \u30b7\u30b9\u30c6\u30e0\u30c6\u30fc\u30d6\u30eb\u3011\"\r\n                strTbl(5) = strTbl(5) & vbCrLf & \" \" & tbl.Name\r\n            Case \"PASS-THROUGH\"\r\n                If strTbl(6) = \"\" Then strTbl(6) = \"\u3010\u30ea\u30f3\u30af\u30c6\u30fc\u30d6\u30eb\uff08ODBC\uff09\u3011\"\r\n                strTbl(6) = strTbl(6) & vbCrLf & \" \" & tbl.Name\r\n        End Select\r\n    Next tbl\r\n    \r\n    '\u30af\u30a8\u30ea\r\n    strQry(1) = \"\u3010\u9078\u629e\u30af\u30a8\u30ea\uff08\u30d1\u30e9\u30e1\u30fc\u30bf\u306a\u3057\uff09\u3011\"\r\n    For Each qry1 In cat.Views\r\n        strQry(1) = strQry(1) & vbCrLf & \" \" & qry1.Name\r\n    Next\r\n    \r\n    strQry(2) = \"\u3010\u30a2\u30af\u30b7\u30e7\u30f3\u30af\u30a8\u30ea\uff06\u30d1\u30e9\u30e1\u30fc\u30bf\u4ed8\u9078\u629e\u30af\u30a8\u30ea\u3011\"\r\n    For Each qry2 In cat.Procedures\r\n        strQry(2) = strQry(2) & vbCrLf & \" \" & qry2.Name\r\n    Next\r\n    \r\n    msg1 = Join(strTbl, vbCrLf)\r\n    msg2 = Join(strQry, vbCrLf)\r\n    \r\n    MsgBox msg1 & vbCrLf & msg2\r\n    \r\nErrHandler:\r\n    If Err.Number <> 0 Then\r\n        MsgBox Err.Number & vbCrLf & Err.Description\r\n    End If\r\n    \r\n    Set cat = Nothing\r\n    Set tbl = Nothing\r\n    Set qry1 = Nothing\r\n    Set qry2 = Nothing\r\n\r\nEnd Sub\r\n\u3000\r\n  <\/pre>\n<br \/>\n<h3>\u5b9f\u884c\u7d50\u679c<\/h3>\n<p><a href=\"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/09\/adox_gettable_query01.jpg?ssl=1\" rel=\"lightbox[6417]\"><img loading=\"lazy\" src=\"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/09\/adox_gettable_query01.jpg?resize=251%2C553&#038;ssl=1\" alt=\"ADOX \u30c6\u30fc\u30d6\u30eb\u540d\u30fb\u30af\u30a8\u30ea\u540d\u3092\u53d6\u5f97\" width=\"251\" height=\"553\" class=\"alignnone size-full wp-image-6419\" srcset=\"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/09\/adox_gettable_query01.jpg?w=251&amp;ssl=1 251w, https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/09\/adox_gettable_query01.jpg?resize=182%2C400&amp;ssl=1 182w\" sizes=\"(max-width: 251px) 100vw, 251px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<\/div>\n<br \/><br \/>\n","protected":false},"excerpt":{"rendered":"<p>\u30c6\u30fc\u30d6\u30eb\u540d\u306e\u53d6\u5f97 Table.Type \u30d7\u30ed\u30d1\u30c6\u30a3 \u3010\u66f8\u5f0f\u3011 \uff1c\u53d6\u5f97\uff1e obje &#8230; <\/p>\n","protected":false},"author":1,"featured_media":6419,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"amp_status":"","spay_email":"","jetpack_publicize_message":""},"categories":[948],"tags":[953,950,1040,1011,1014,814,1026,955,949],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/09\/adox_gettable_query01.jpg?fit=251%2C553&ssl=1","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4Ye9i-1Fv","_links":{"self":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/6417"}],"collection":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/comments?post=6417"}],"version-history":[{"count":3,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/6417\/revisions"}],"predecessor-version":[{"id":6469,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/6417\/revisions\/6469"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media\/6419"}],"wp:attachment":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media?parent=6417"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/categories?post=6417"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/tags?post=6417"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}