{"id":211,"date":"2015-12-26T15:29:18","date_gmt":"2015-12-26T20:29:18","guid":{"rendered":"http:\/\/access-diva.com\/blog\/?p=211"},"modified":"2016-07-08T21:04:01","modified_gmt":"2016-07-09T01:04:01","slug":"changing-a-label-caption-on-a-report","status":"publish","type":"post","link":"https:\/\/access-diva.com\/blog\/?p=211","title":{"rendered":"Changing a Label Caption on a Report"},"content":{"rendered":"<p>If you do Quotes and Invoicing (or Purchase Orders and Invoicing) they generally share the same layout, the only difference being the Label identifying them.\u00a0 Rather than creating to reports you can change the Label Caption depending on which Form you are opening it from.<\/p>\n<p>Step 1<img loading=\"lazy\" decoding=\"async\" class=\"alignright wp-image-263 size-full\" src=\"http:\/\/access-diva.com\/blog\/wp-content\/uploads\/2015\/12\/Caption.png\" alt=\"Caption\" width=\"248\" height=\"141\" srcset=\"https:\/\/access-diva.com\/blog\/wp-content\/uploads\/2015\/12\/Caption.png 248w, https:\/\/access-diva.com\/blog\/wp-content\/uploads\/2015\/12\/Caption-150x85.png 150w\" sizes=\"auto, (max-width: 248px) 100vw, 248px\" \/><\/p>\n<p>Create the Report and for the Label Caption put the name of the one that is used more often.\u00a0 So, for my Report I put <strong>Invoice<\/strong> because I print a lot more invoices than I do quotes.\u00a0 Make sure the Label is long enough to accommodate the character count of the longest word, i.e. <strong>Purchase Order<\/strong>.<\/p>\n<p>Step 2<br \/>\nIn the Reports On_Open event place&#8230;<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\"> \r\n  If Not IsNull(Me.OpenArgs) Then\r\n      Me.Controls(&quot;lblInvoice&quot;).Caption = Me.OpenArgs\r\n  End If\r\n<\/pre>\n<p>&#8230;save and close the Report.<\/p>\n<p>Step 3<br \/>\nFrom the Form that you use to generate your Invoice there is nothing to do, so, go to the one that you use for Quotes.\u00a0 In Design Mode go to the Command Button(s) you are using for Preview (and\u00a0Print, if you have one).\u00a0 Between the <strong>Private Sub&#8230;<\/strong> and<strong> End Sub<\/strong> enter&#8230;<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n    Dim strCaption As String\r\n    strCaption = &quot;Quotation&quot;\r\n<\/pre>\n<p>Then depending on whether you have a WHERE clause&#8230;<br \/>\nNo WHERE clause<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n    DoCmd.OpenReport &quot;rptInvoice&quot;, acViewPreview, , , , strCaption\r\n<\/pre>\n<p>With a WHERE clause (This sample only includes where the WHERE would go.\u00a0 \ud83d\ude42 )<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n    DoCmd.OpenReport &quot;rptInvoice&quot;, acViewPreview, , strWhere, , strCaption\r\n<\/pre>\n<p>(Don&#8217;t forget some Error Code!)\u00a0 Save, close and test! All done!<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_211\" class=\"pvc_stats all  \" data-element-id=\"211\" 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>If you do Quotes and Invoicing (or Purchase Orders and Invoicing) they generally share the same layout, the only difference being the Label identifying them. Rather than creating to reports you can change the Label Caption depending on which Form you are opening it from.<\/p>\n<p>Step 1<\/p>\n<p>Create the Report and for the Label Caption [&#8230;]<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_211\" class=\"pvc_stats all  \" data-element-id=\"211\" 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,25],"tags":[89,88],"class_list":["post-211","post","type-post","status-publish","format-standard","hentry","category-access-tips","category-reports","tag-label-caption","tag-reports","odd"],"_links":{"self":[{"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/211","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=211"}],"version-history":[{"count":9,"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/211\/revisions"}],"predecessor-version":[{"id":385,"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/211\/revisions\/385"}],"wp:attachment":[{"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=211"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=211"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/access-diva.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=211"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}