Dynamically Change Color On Text Object Follow

0
Avatar
Legacy Poster

I was hoping for some VB assistance in Bartender Automation 9.4 SR3.

I am creating labels using a SQL database connection and want one text field to have a background color that is dependent upon another database field (that is not placed in the label but part of the same table). The BarTender text object is called "ItemText". I would like the background fill color to change based on criteria from a field in the same table. That field is not currently a part of the label and it is called "Prod_cat" in the SQL database. When this field is equal to a "B1", I would like the background color of "ItemText" to be red. When this field is equal to a "B2", I would like the background color of "ItemText" to be aqua. I am having trouble returning anything from the Label Format Options OnNewRecord event. Can someone please help me with the syntax and where I need to put these items? Anything I have tried has resulted in a 12345678 error or worse.

Thank you for your assistance.

2 comments

0
Avatar
Legacy Poster
Comment actions Permalink

Bump. Anyone?
0
Avatar
Ian Einman
Comment actions Permalink

BarTender may not read database fields if it thinks that no object is using that field.  Try creating a text object that references the database field, and then drag that text object off of the label so it doesn't print.  Then, go to your Document Options / VB Scripting / OnNewRecord event and try setting FillColor of the object based on the value of that text object.  Let us know if that helps.

Please sign in to leave a comment.