Conditional italicization of fields
I want to conditionally italicize database fields in my label if they contain 'n/a'. I know that this can be done using document level scripts. This VBScript can only be used for one field:
Set TextObj = Objects("TextObject")
If (Field("FieldName") = "n/a") Then
TextObj.FontItalic = True
Else
TextObj.FontItalic = False
End If
I want to do this for all the database fields through looping. How do I refer to all the database fields in my label? I can't seem to find it in the VBScripting reference guide. Thank you.
-
Peter Thane
★ BarTender Hero ★
Probably a simpler way is to forget going down the VB route and just add a 2nd label template that is identical to the 1st other than the fields are in bold.
If you then go into the Properties of the template (or via the Page Setup) you can then set these to conditionally print, one if the value of Field Name = "n/a" and the other is the Value does not equal "n/a".
Below I am using the Dept value to determine if the bold template prints or not, so that it does if the Dept = "X"
To make it more obvious for the sample I have also dragged the Bold fields to the right hand side of the label, but this is how my little database prints
0 -
Focusonthegoal11
★ BarTender Hero ★
This works, although I want to do this italicization one field at a time. I got the idea from you to use conditional printing. What I did was duplicate the text objects, so there are two: one normal and the other italicized, and then set the condition that the italicized field will only be printed if the value of the field is 'n/a' and the other will be printed if it is not 'n/a'. Thanks a lot!
0
Please sign in to leave a comment.
Comments
2 comments