Senin, 22 Februari 2016

[MS_AccessPros] Show/Hide labels based on value in a field on a report

 

Hello everyone,


I have a set up reports in an Access 2003-based front end (linked to a SQL 2008 database) used for printing production orders.  The reports are identical, but are based are different queries (for selecting individual orders or ranges of orders based on different criteria).  I have been asked to add a series of "check boxes" to this report.  These "check boxes" should only be visible depending on whether or not certain code appears in a given field (called COMCDE_01) on the report (the same field appears in all of the reports/queries), and would not be something the users of these reports would actually select.  Instead, they're intended as a checklist for shop workers that would received the printed orders, to make sure that said workers complete certain production steps (the boxes would be checked in pen as the steps are completed).  I originally was going to use a set of unbound text boxes, with one text box per check box and the box the shop worker would check being the blank text box with it's borders visible.  I wanted to use conditional formatting to show/hide the boxes, but apparently this isn't possible with text box borders.  Instead, I found that I would have to use VBA code to accomplish this.  Here's my sample code for one of the text boxes:


Private Sub Text293()

IIf(Me![COMCDE_01] Like "*B*", Me!Text293.Visible = True, Me!Text293.Visible = False)


End Sub


I'm not looking for COMCDE_01 to equal a specific value, but rather to have the text box be visible if the COMCDE_01 field for a given order contained a "B" anywhere in the field (and have the text box be invisible if there is no "B" in the field).  Unfortunately the VBA debugger in Access (I'm using 2010) doesn't like this setup (it's expecting COMCDE_01 to equal something specific as a condition).


How can I resolve this dilemma?  I originally considered a label only, but couldn't figure out how to print a box-like symbol in a label (though I'm willing to just use an underscore instead (like ____ ).  I would greatly appreciate any suggestions on this.


Thanks in advance,

Michael

__._,_.___

Posted by: mbentfeld@yahoo.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)

.

__,_._,___

Tidak ada komentar:

Poskan Komentar