{"id":975,"date":"2017-02-22T08:29:31","date_gmt":"2017-02-21T23:29:31","guid":{"rendered":"http:\/\/okamurax.com\/?p=975"},"modified":"2018-03-19T03:21:33","modified_gmt":"2018-03-18T18:21:33","slug":"vba-access%e3%81%ae%e3%82%af%e3%82%a8%e3%83%aa%e3%82%92%e5%91%bc%e3%81%b3%e5%87%ba%e3%81%99","status":"publish","type":"post","link":"https:\/\/appbay.org\/?p=975","title":{"rendered":"AccessVBA \u30af\u30a8\u30ea\u3092\u547c\u3073\u51fa\u3059"},"content":{"rendered":"<pre class=\"lang:vb decode:true \">Sub test()\r\n\r\n'Access\u306b\u3042\u308b\u30af\u30a8\u30ea\u3092\u4f5c\u6210\u3059\u308b\u30d7\u30ed\u30b7\u30fc\u30b8\u30e3\u3092\u547c\u3076\r\n'\u30af\u30a8\u30ea\u3092\u4f5c\u3063\u3066\u3042\u308bmdb\u306a\u3089\u4e0d\u8981\r\n\r\nSet a = CreateObject(\"Access.Application\")\r\n\r\nWith a\r\n.OpenCurrentDatabase \"xxx.mdb\"\r\n.Visible = False\r\n.Application.Run \"xxx\"\r\n.Quit\r\nEnd With\r\n\r\nSet a = Nothing\r\n\r\n'\u3053\u3053\u304b\u3089\u306fADO\r\n\r\nSet c = CreateObject(\"ADODB.Connection\")\r\nSet r = CreateObject(\"ADODB.Recordset\")\r\n\r\nc.Open \"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=xxx.mdb;\"\r\nr.Open \"test\", c\r\n\r\n'\u30af\u30a8\u30ea\u3067\u52d5\u7684\u306a\u30c6\u30fc\u30d6\u30eb\u3092\u958b\u304f\u3002\r\n'\u3061\u3083\u3093\u3068SQL Server\u307e\u3067\u8aad\u307f\u306b\u3044\u3063\u3066\u3044\u308b\uff61Access\u306e\u4e2d\u306b\u30ad\u30e3\u30c3\u30b7\u30e5\u306a\u3069\u3057\u3066\u3044\u306a\u3044\u3088\u3046\r\n\r\nActiveSheet.Cells(1, 1).CopyFromRecordset r\r\n\r\nEnd Sub\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Sub test() &#8216;Access\u306b\u3042\u308b\u30af\u30a8\u30ea\u3092\u4f5c\u6210\u3059\u308b\u30d7\u30ed\u30b7\u30fc\u30b8\u30e3\u3092\u547c\u3076 &#8216;\u30af\u30a8\u30ea\u3092\u4f5c\u3063\u3066\u3042\u308bmdb\u306a\u3089\u4e0d\u8981 Set a = CreateObject(&#8220;Access.Application&#8221;) With a .Op &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/appbay.org\/?p=975\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;AccessVBA \u30af\u30a8\u30ea\u3092\u547c\u3073\u51fa\u3059&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[5],"class_list":["post-975","post","type-post","status-publish","format-standard","hentry","category-1","tag-vba"],"_links":{"self":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/975","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=975"}],"version-history":[{"count":3,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/975\/revisions"}],"predecessor-version":[{"id":3974,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/975\/revisions\/3974"}],"wp:attachment":[{"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=975"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=975"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=975"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}