{"id":6066,"date":"2017-09-01T09:39:00","date_gmt":"2017-09-01T00:39:00","guid":{"rendered":"http:\/\/excelwork.info\/excel\/?p=6066"},"modified":"2017-09-01T09:44:45","modified_gmt":"2017-09-01T00:44:45","slug":"adobofeof","status":"publish","type":"post","link":"https:\/\/excelwork.info\/excel\/adobofeof\/","title":{"rendered":"BOF \u30d7\u30ed\u30d1\u30c6\u30a3\u30fbEOF \u30d7\u30ed\u30d1\u30c6\u30a3\uff08ADO\uff09"},"content":{"rendered":"<h2>EOF \u30d7\u30ed\u30d1\u30c6\u30a3\u30fbBOF \u30d7\u30ed\u30d1\u30c6\u30a3<\/h2>\n<div class=\"m30-l\">\n<p><strong>BOF \u30d7\u30ed\u30d1\u30c6\u30a3<\/strong>\u306f\u3001\u30ab\u30ec\u30f3\u30c8\u30ec\u30b3\u30fc\u30c9\u306e\u4f4d\u7f6e\u304c <strong>Recordset \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong>\u306e\u6700\u521d\u306e\u30ec\u30b3\u30fc\u30c9\u3088\u308a\u524d\u306b\u3042\u308b\u304b\u3069\u3046\u304b\u3092\u793a\u3057\u307e\u3059\u3002<strong>EOF \u30d7\u30ed\u30d1\u30c6\u30a3<\/strong>\u306f\u3001\u30ab\u30ec\u30f3\u30c8\u30ec\u30b3\u30fc\u30c9\u306e\u4f4d\u7f6e\u304c <strong>Recordset \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong>\u306e\u6700\u5f8c\u306e\u30ec\u30b3\u30fc\u30c9\u3088\u308a\u5f8c\u306b\u3042\u308b\u304b\u3069\u3046\u304b\u3092\u793a\u3057\u307e\u3059\u3002<\/p>\n<br \/>\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>boolean_bof<\/em> = <em>object<\/em>.<strong>BOF<\/strong><br \/>\n    <em>boolean_eof<\/em> = <em>object<\/em>.<strong>EOF<\/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>Recordset \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong><\/span>\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>boolean_bof&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u30d6\u30fc\u30eb\u578b\uff08boolean\uff09\u306e\u5024\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002\u30ab\u30ec\u30f3\u30c8\u30ec\u30b3\u30fc\u30c9\u306e\u4f4d\u7f6e\u304c <strong>Recordset \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong>\u306e\u6700\u521d\u306e\u30ec\u30b3\u30fc\u30c9\u3088\u308a\u524d\u306b\u3042\u308b\u5834\u5408\u306f\u3001<strong>True<\/strong>\uff08-1\uff09\u3001\u30ab\u30ec\u30f3\u30c8\u30ec\u30b3\u30fc\u30c9\u306e\u4f4d\u7f6e\u304c\u6700\u521d\u306e\u30ec\u30b3\u30fc\u30c9\u4e0a\u307e\u305f\u306f\u305d\u308c\u4ee5\u964d\u306b\u3042\u308b\u5834\u5408\u306f\u3001<strong>False<\/strong>\uff080\uff09\u3068\u306a\u308a\u307e\u3059\u3002<\/li>\n<li>boolean_eof&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u30d6\u30fc\u30eb\u578b\uff08boolean\uff09\u306e\u5024\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002\u30ab\u30ec\u30f3\u30c8\u30ec\u30b3\u30fc\u30c9\u306e\u4f4d\u7f6e\u304c <strong.Recordset \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong>\u306e\u6700\u5f8c\u306e\u30ec\u30b3\u30fc\u30c9\u3088\u308a\u5f8c\u306b\u3042\u308b\u5834\u5408\u306f\u3001<strong>True<\/strong>\uff08-1\uff09\u3001\u30ab\u30ec\u30f3\u30c8\u30ec\u30b3\u30fc\u30c9\u306e\u4f4d\u7f6e\u304c\u6700\u5f8c\u306e\u30ec\u30b3\u30fc\u30c9\u4e0a\u307e\u305f\u306f\u305d\u308c\u4ee5\u524d\u306b\u3042\u308b\u5834\u5408\u306f\u3001<strong>False<\/strong>\uff080\uff09\u3068\u306a\u308a\u307e\u3059\u3002<\/li>\n<\/ul>\n<br \/>\n<p class=\"caution4\"><strong>BOF<\/strong>\u3001<strong>EOF<\/strong> \u306e\u3044\u305a\u308c\u304b\u304c <strong>True<\/strong> \u306e\u5834\u5408\u3001\u30ab\u30ec\u30f3\u30c8\u30ec\u30b3\u30fc\u30c9\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p class=\"caution4\"><strong>BOF<\/strong>\u3001<strong>EOF<\/strong> \u5171\u306b <strong>True<\/strong> \u306e\u5834\u5408\u3001<strong>Recordset<\/strong> \u306b\u306f\u3001\u30ec\u30b3\u30fc\u30c9\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p class=\"caution4\"><strong>BOF<\/strong>\u3001<strong>EOF<\/strong> \u5171\u306b <strong>False<\/strong> \u306e\u5834\u5408\u3001<strong>Recordset<\/strong> \u306b\u306f\u3001\u5c11\u306a\u304f\u3068\u3082\uff11\u3064\u306e\u30ec\u30b3\u30fc\u30c9\u304c\u683c\u7d0d\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u307e\u305f\u3001\u6700\u5f8c\u306e\u30ec\u30b3\u30fc\u30c9\u3092\u524a\u9664\u3057\u305f\u5834\u5408\u3067\u3082\u30ab\u30ec\u30f3\u30c8\u30ec\u30b3\u30fc\u30c9\u306e\u4f4d\u7f6e\u3092\u79fb\u52d5\u3059\u308b\u307e\u3067\u306f\u3001<strong>BOF<\/strong>\u3001<strong>EOF<\/strong> \u5171\u306b <strong>False<\/strong> \u306e\u307e\u307e\u3067\u3059\u3002<\/p>\n<\/p><\/div>\n<\/div>\n<br \/><br \/>\n<h2>BOF \u30d7\u30ed\u30d1\u30c6\u30a3\u30fbEOF \u30d7\u30ed\u30d1\u30c6\u30a3 \u4f7f\u7528\u4f8b<\/h2>\n<div class=\"m30-l\">\n<h3 id=\"vba_sample\">\u30b5\u30f3\u30d7\u30ebVBA\u30bd\u30fc\u30b9<\/h3>\n<pre class=\"lang:vb mark:0 decode:true \" title=\"BOF \u30d7\u30ed\u30d1\u30c6\u30a3\u30fbEOF \u30d7\u30ed\u30d1\u30c6\u30a3\" data-url=\"http:\/\/example.co.jp\" >\r\n\u3000\r\nSub Sample_ADO_BOFEOF()\r\n    \r\n    '\u53c2\u7167\u8a2d\u5b9a:Microsoft ActiveX Data Objects 6.1 Library\r\n    \r\n    Dim cn As ADODB.Connection\r\n    Dim Rs As ADODB.Recordset\r\n    Dim constr As String\r\n    Dim DBFile As String\r\n    Dim strSQL As String\r\n    Dim i As Long\r\n    Dim j As Long\r\n    \r\n    DBFile = ActiveWorkbook.Path & \"\\mydb1.accdb\"\r\n    constr = \"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\" & DBFile\r\n    \r\n    Set cn = New ADODB.Connection\r\n    cn.ConnectionString = constr\r\n    cn.Open\r\n    \r\n    strSQL = \"Select * from \u793e\u54e1\u540d\u7c3f;\"\r\n    \r\n    Set Rs = New ADODB.Recordset\r\n    Rs.Source = strSQL\r\n    Rs.ActiveConnection = cn\r\n    Rs.Open\r\n    \r\n    With Worksheets(\"Sheet1\")\r\n    \r\n        If Rs.BOF And Rs.EOF Then\r\n            MsgBox \"\u300c\u793e\u54e1\u540d\u7c3f\u300d\u306b\u306f\u30ec\u30b3\u30fc\u30c9\u304c\u3042\u308a\u307e\u305b\u3093\"\r\n        Else\r\n            Rs.MoveFirst\r\n            i = 1\r\n            .Cells.Clear\r\n            Do Until Rs.EOF\r\n                For j = 0 To Rs.Fields.Count - 1\r\n                    .Cells(i, j + 1) = Rs(j).Value\r\n                Next j\r\n                Rs.MoveNext\r\n                i = i + 1\r\n            Loop\r\n            MsgBox \"\u300c\u793e\u54e1\u540d\u7c3f\u300d\u306b\u306f\u30ec\u30b3\u30fc\u30c9\u304c\u3042\u308a\u307e\u3059\"\r\n        End If\r\n        \r\n    End With\r\n    \r\n    Rs.Close\r\n    Set Rs = Nothing\r\n    \r\n    cn.Close\r\n    Set cn = 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:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/07\/adobofeof_01.jpg?ssl=1\" rel=\"lightbox[6066]\"><img loading=\"lazy\" src=\"https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/07\/adobofeof_01.jpg?resize=580%2C278&#038;ssl=1\" alt=\"BOF \u30d7\u30ed\u30d1\u30c6\u30a3\u30fbEOF \u30d7\u30ed\u30d1\u30c6\u30a3\" width=\"580\" height=\"278\" class=\"alignnone size-large wp-image-6068\" srcset=\"https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/07\/adobofeof_01.jpg?resize=580%2C278&amp;ssl=1 580w, https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/07\/adobofeof_01.jpg?resize=400%2C192&amp;ssl=1 400w, https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/07\/adobofeof_01.jpg?w=699&amp;ssl=1 699w\" sizes=\"(max-width: 580px) 100vw, 580px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<\/div>\n<br \/><br \/>\n","protected":false},"excerpt":{"rendered":"<p>EOF \u30d7\u30ed\u30d1\u30c6\u30a3\u30fbBOF \u30d7\u30ed\u30d1\u30c6\u30a3 BOF \u30d7\u30ed\u30d1\u30c6\u30a3\u306f\u3001\u30ab\u30ec\u30f3\u30c8\u30ec\u30b3\u30fc\u30c9\u306e &#8230; <\/p>\n","protected":false},"author":1,"featured_media":6068,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"amp_status":"","spay_email":"","jetpack_publicize_message":""},"categories":[948],"tags":[953,950,972,721,971,968,970,952,951,814,955,949,835],"jetpack_featured_media_url":"https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/07\/adobofeof_01.jpg?fit=699%2C335&ssl=1","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4Ye9i-1zQ","_links":{"self":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/6066"}],"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=6066"}],"version-history":[{"count":6,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/6066\/revisions"}],"predecessor-version":[{"id":6218,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/6066\/revisions\/6218"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media\/6068"}],"wp:attachment":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media?parent=6066"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/categories?post=6066"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/tags?post=6066"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}