{"id":925,"date":"2014-05-21T15:16:34","date_gmt":"2014-05-21T19:16:34","guid":{"rendered":"http:\/\/regina-whipp.com\/blog\/?p=925"},"modified":"2016-07-08T23:04:05","modified_gmt":"2016-07-09T03:04:05","slug":"conditional-row-shading-on-a-continuous-form","status":"publish","type":"post","link":"https:\/\/regina-whipp.com\/blog\/?p=925","title":{"rendered":"Conditional Row Shading on a Continuous Form"},"content":{"rendered":"<p>Row Shading has come a long way since Access 2003 where you had to use code to get it to happen. Remember this&#8230;<\/p>\n<p>Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)<\/p>\n<p>If bluebar Then<br \/>\nDetail.BackColor = 16777215<br \/>\nElse<br \/>\nDetail.BackColor = 13888992<br \/>\nEnd If<\/p>\n<p>bluebar = Not (bluebar)<\/p>\n<p>End Sub<\/p>\n<p>Then came Access 2007 and we got Alternate Back Color&#8230;<\/p>\n<div id=\"attachment_927\" style=\"width: 490px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-927\" class=\"wp-image-927 size-full\" src=\"http:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2014\/05\/RowShadingAlternateBackColor.png\" alt=\"Property Sheet Alternate Back Color\" width=\"480\" height=\"345\" srcset=\"https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2014\/05\/RowShadingAlternateBackColor.png 480w, https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2014\/05\/RowShadingAlternateBackColor-300x215.png 300w, https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2014\/05\/RowShadingAlternateBackColor-150x107.png 150w, https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2014\/05\/RowShadingAlternateBackColor-400x287.png 400w\" sizes=\"auto, (max-width: 480px) 100vw, 480px\" \/><p id=\"caption-attachment-927\" class=\"wp-caption-text\">Property Sheet Alternate Back Color<\/p><\/div>\n<p>While that was way cool, what was still missing was a way to conditionally shade a row. Here\u2019s a way to do just that with no VBA&#8230;<\/p>\n<h6><strong>Step 1<\/strong><\/h6>\n<p><strong>Note<\/strong>: In this example the Control names are <strong>chkInStock<\/strong>, a Check Box and <strong>txtInStock<\/strong>, an unbound Text Box.<\/p>\n<p>Identify a Control (*trigger*) that will let Access know you want to highlight that row. For this example we\u2019re using the Check Box, chkInStock.\u00a0 Then in your unbound\u00a0Text Box and type&#8230;<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n=IIf(&#x5B;chkInStock]=True,&quot;\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588&quot;,&quot;&quot;)\r\n<\/pre>\n<p>Stretch the Control to the full length of the Row, set the Font Size to insure it goes the Height of the Row and select the color of the Font for your Control (this is what determines the color of the highlighting).\u00a0 In this example I used #F6FBDD.<\/p>\n<div id=\"attachment_935\" style=\"width: 916px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-935\" class=\"wp-image-935 size-full\" src=\"http:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2014\/05\/RowShadingDesignMode.png\" alt=\"Row Shading (Design Mode)\" width=\"906\" height=\"122\" srcset=\"https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2014\/05\/RowShadingDesignMode.png 906w, https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2014\/05\/RowShadingDesignMode-300x40.png 300w, https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2014\/05\/RowShadingDesignMode-150x20.png 150w, https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2014\/05\/RowShadingDesignMode-400x53.png 400w\" sizes=\"auto, (max-width: 906px) 100vw, 906px\" \/><p id=\"caption-attachment-935\" class=\"wp-caption-text\">Row Shading (Design Mode)<\/p><\/div>\n<p><strong>Side note<\/strong>: For Bar (Full *Black* Block)\u00a0use *Arial<strong> U + 2588 <\/strong>Full Block*.\u00a0 To insert the Full Block&#8230;<\/p>\n<p>a.\u00a0 Open your Windows Character Map, found under <strong>Accessories<\/strong> &gt; <strong>System Tools<\/strong> and select the Arial Font from the Font drop down.<\/p>\n<div id=\"attachment_929\" style=\"width: 457px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-929\" class=\"wp-image-929 size-full\" src=\"http:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2014\/05\/CharacterMapSelect.png\" alt=\"Character Map\" width=\"447\" height=\"406\" srcset=\"https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2014\/05\/CharacterMapSelect.png 447w, https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2014\/05\/CharacterMapSelect-300x272.png 300w, https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2014\/05\/CharacterMapSelect-150x136.png 150w, https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2014\/05\/CharacterMapSelect-400x363.png 400w\" sizes=\"auto, (max-width: 447px) 100vw, 447px\" \/><p id=\"caption-attachment-929\" class=\"wp-caption-text\">Character Map<\/p><\/div>\n<p>b. Once selected click <strong>Copy<\/strong> and then navigate back to Access<\/p>\n<div id=\"attachment_930\" style=\"width: 457px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-930\" class=\"wp-image-930 size-full\" src=\"http:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2014\/05\/CharacterMapCopy.png\" alt=\"Character Map (Copy)\" width=\"447\" height=\"406\" srcset=\"https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2014\/05\/CharacterMapCopy.png 447w, https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2014\/05\/CharacterMapCopy-300x272.png 300w, https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2014\/05\/CharacterMapCopy-150x136.png 150w, https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2014\/05\/CharacterMapCopy-400x363.png 400w\" sizes=\"auto, (max-width: 447px) 100vw, 447px\" \/><p id=\"caption-attachment-930\" class=\"wp-caption-text\">Character Map (Copy)<\/p><\/div>\n<p>c. In Access, paste the Full Block <strong>within<\/strong> your Statement on the <strong>Control Source<\/strong> line&#8230;<\/p>\n<div id=\"attachment_932\" style=\"width: 531px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-932\" class=\"wp-image-932 size-full\" src=\"http:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2014\/05\/PropertySheetRowShading.png\" alt=\"Property Sheet Control Source\" width=\"521\" height=\"358\" srcset=\"https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2014\/05\/PropertySheetRowShading.png 521w, https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2014\/05\/PropertySheetRowShading-300x206.png 300w, https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2014\/05\/PropertySheetRowShading-150x103.png 150w, https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2014\/05\/PropertySheetRowShading-400x274.png 400w\" sizes=\"auto, (max-width: 521px) 100vw, 521px\" \/><p id=\"caption-attachment-932\" class=\"wp-caption-text\">Property Sheet Control Source<\/p><\/div>\n<h6>Step 2<\/h6>\n<p>You can set your <strong>Controls<\/strong> to anything you like,\u00a0however, I would recommend you give your Controls some sort of Border.\u00a0 This will not only help ditinguish Columns but also Rows.\u00a0 In this example\u00a0all the Controls in the Row are set to&#8230;<\/p>\n<p><strong>Back Style<\/strong>:\u00a0 Transparent<br \/>\n<strong>Back Color<\/strong>:\u00a0 No Color<br \/>\n<strong>Border Width<\/strong>:\u00a0 Hairline<br \/>\n<strong>Border Color<\/strong>:\u00a0 #C0C0C0<br \/>\n<strong>Special Effect<\/strong>:\u00a0 Etched<\/p>\n<h6>Step 3 (Optional)<\/h6>\n<p>In this example the <strong>Detail<\/strong> section of the <strong>Form<\/strong> has been set to alternate colors, you can choose whatever option suits your database.\u00a0 To set the Rows in the <strong>Detail<\/strong> section to alternate colors, in the <strong>Properties<\/strong> window for the <strong>Detail<\/strong> section set the&#8230;<\/p>\n<p><strong>Back Color<\/strong>:\u00a0 Background 1 (or White)<br \/>\n<strong>Alternate Back Color<\/strong>:\u00a0 #F5F4F1<\/p>\n<h6>Step 4<\/h6>\n<p>Save and you\u2019re all done.\u00a0 Now, when you select\/deselect the In Stock Check Box the row will toggle according. Enjoy!<\/p>\n<p>Download the sample file <a href=\"http:\/\/www.access-diva.com\/myzipfiles\/RowShading.zip\" target=\"_blank\"><strong>here<\/strong><\/a>.<\/p>\n<div id=\"attachment_934\" style=\"width: 890px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-934\" class=\"wp-image-934 size-full\" src=\"http:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2014\/05\/RowShading.png\" alt=\"Row Shading\" width=\"880\" height=\"237\" srcset=\"https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2014\/05\/RowShading.png 880w, https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2014\/05\/RowShading-300x80.png 300w, https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2014\/05\/RowShading-150x40.png 150w, https:\/\/regina-whipp.com\/blog\/wp-content\/uploads\/2014\/05\/RowShading-400x107.png 400w\" sizes=\"auto, (max-width: 880px) 100vw, 880px\" \/><p id=\"caption-attachment-934\" class=\"wp-caption-text\">Row Shading<\/p><\/div>\n<p>&nbsp;<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_925\" class=\"pvc_stats all  \" data-element-id=\"925\" 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:\/\/regina-whipp.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>Row Shading has come a long way since Access 2003 where you had to use code to get it to happen. Remember this&#8230;<\/p>\n<p>Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)<\/p>\n<p>If bluebar Then Detail.BackColor = 16777215 Else Detail.BackColor = 13888992 End If<\/p>\n<p>bluebar = Not (bluebar)<\/p>\n<p>End Sub<\/p>\n<p>Then came Access 2007 and we [&#8230;]<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_925\" class=\"pvc_stats all  \" data-element-id=\"925\" 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:\/\/regina-whipp.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],"tags":[41,31,52],"class_list":["post-925","post","type-post","status-publish","format-standard","hentry","category-access-tips","tag-continuous-forms","tag-forms","tag-row-shading","odd"],"_links":{"self":[{"href":"https:\/\/regina-whipp.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/925","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/regina-whipp.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/regina-whipp.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/regina-whipp.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/regina-whipp.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=925"}],"version-history":[{"count":14,"href":"https:\/\/regina-whipp.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/925\/revisions"}],"predecessor-version":[{"id":1288,"href":"https:\/\/regina-whipp.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/925\/revisions\/1288"}],"wp:attachment":[{"href":"https:\/\/regina-whipp.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=925"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/regina-whipp.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=925"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/regina-whipp.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=925"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}