{"id":241,"date":"2015-11-12T00:12:35","date_gmt":"2015-11-12T05:12:35","guid":{"rendered":"http:\/\/access-diva.com\/blog\/?p=241"},"modified":"2016-08-13T17:57:45","modified_gmt":"2016-08-13T21:57:45","slug":"sql-to-vba","status":"publish","type":"post","link":"https:\/\/access-diva.com\/blog\/?p=241","title":{"rendered":"SQL to VBA"},"content":{"rendered":"<p>Recently, I saw a post regarding moving a Query (SQL) to VBA.\u00a0 I remember I saw something somewhere that automated this task but could not remember where.\u00a0 Well, after a little surfing of my favorite sites I found it&#8230; <a href=\"http:\/\/allenbrowne.com\/ser-71.html\" target=\"_blank\">Copy SQL statement from query to VBA<\/a>\u00a0by <a href=\"http:\/\/allenbrowne.com\/tips.html\" target=\"_blank\">Allen Browne<\/a>.\u00a0 And, because I couldn&#8217;t leave well enough alone, I created the database following the steps listed and, for fun,\u00a0added a *Copy to Clipboard* button just so you can now click the button and paste, with Ctrl+V, right into the VB Editor&#8230;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-242 size-full\" src=\"http:\/\/access-diva.com\/blog\/wp-content\/uploads\/2015\/11\/SQLtoVBA.png\" alt=\"SQLtoVBA\" width=\"779\" height=\"592\" srcset=\"https:\/\/access-diva.com\/blog\/wp-content\/uploads\/2015\/11\/SQLtoVBA.png 779w, https:\/\/access-diva.com\/blog\/wp-content\/uploads\/2015\/11\/SQLtoVBA-300x228.png 300w, https:\/\/access-diva.com\/blog\/wp-content\/uploads\/2015\/11\/SQLtoVBA-150x114.png 150w, https:\/\/access-diva.com\/blog\/wp-content\/uploads\/2015\/11\/SQLtoVBA-400x304.png 400w\" sizes=\"auto, (max-width: 779px) 100vw, 779px\" \/><\/p>\n<p>&#8230;and you can download it <a href=\"http:\/\/www.access-diva.com\/myzipfiles\/SQL2VBA.zip\" target=\"_blank\">here<\/a>.<\/p>\n<p><span style=\"color: #cc1818;\">Note<\/span>: The SQL cannot be used as RowSource for any Control or RecordSource for any Form.<\/p>\n<p>11.13.2015 \u00a0Amended so you can now also convert INSERT, DELETE and UPDATE queries as well.\u00a0 Enjoy!<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_241\" class=\"pvc_stats all  \" data-element-id=\"241\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/access-diva.com\/blog\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Recently, I saw a post regarding moving a Query (SQL) to VBA. I remember I saw something somewhere that automated this task but could not remember where. Well, after a little surfing of my favorite sites I found it&#8230; Copy SQL statement from query to VBA by Allen Browne. And, because I couldn&#8217;t leave well [&#8230;]<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_241\" class=\"pvc_stats all  \" data-element-id=\"241\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/access-diva.com\/blog\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,41],"tags":[18,82,76],"class_list":["post-241","post","type-post","status-publish","format-standard","hentry","category-access-tips","category-vba","tag-queries","tag-sql","tag-vba","odd"],"_links":{"self":[{"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/241","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=241"}],"version-history":[{"count":5,"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/241\/revisions"}],"predecessor-version":[{"id":422,"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/241\/revisions\/422"}],"wp:attachment":[{"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=241"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=241"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}